/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * A V4L2 driver for nvp6134 cameras and AHD Coax protocol.
 *
 * Copyright (C) 2016 	NEXTCHIP Inc. All rights reserved.
 * Description	: communicate between Decoder and ISP
 * 				  get information(AGC, motion, FPS) of ISP
 * 				  set NRT/RT
 * 				  upgrade Firmware of ISP
 * Authors:
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
  */

#include "../../../utility/vin_log.h"
#include "eq_common.h"
#include "common.h"
#include "video.h"

/* ******************************************************************************
 * extern variable
 ****************************************************************************** */
extern unsigned int nvp6134_iic_addr[4];
extern unsigned char ch_mode_status[16];
extern unsigned char ch_vfmt_status[16];
extern unsigned int nvp6134_cnt;

/* ******************************************************************************
 * internal variable
 ****************************************************************************** */

/* ******************************************************************************
 *
 *	This table is EQ distance table
 *  The customer can change this value according to the environment
 *  	- EQ_DEFAULT_STAGE_VAL : Nextchip default distance value
 *		- EQ_USER_STAGE_VAL    : Custormer distance value
 *		s_eq_distance_table[eq_tbl_num][0][EQ_DEFAULT_STAGE_VAL]
 *		s_eq_distance_table[eq_tbl_num][0][EQ_USER_STAGE_VAL]
 *			{
 *
 *	  in case of AHD, CHD
 *	 //Y SUM, reserved(customer value)
 *		{  0,     0},	// stage 0 : No EQ(NO INPUT)
 *		{381,     0},	// stage 1 : 0~100M(short)
 *		....
 *		....
 *
 *	  in case of THD
 *	 //EQ pattern, reserved(customer value)
 *		{  0,     0},	// stage 0 : No EQ(NO INPUT)
 *		{381,     0},	// stage 1 : 0~100M(short)
 *		....
 *		....
 *
 ****************************************************************************** */
#define EQ_DEFAULT_STAGE_VAL 0
#define EQ_USER_STAGE_VAL 1
unsigned int g_slp_ahd[16] = {0};

static const int s_eq_thd_re_table[7][2] = {
	{0, 0},    /*  stage 0 : No EQ(NO INPUT)  */
	{1, 0},    /*  stage 1 : 0~50M(short)  */
	{1, 0},    /*  stage 2 : 50~150M  */
	{1, 0},    /*  stage 3 : 150~250M  */
	{1400, 0}, /*  stage 4 : 250~350M  */
	{2000, 0}, /*  stage 5 : 350~450M  */
	{2046, 0}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_re_table_720P_A[7][2] = {
	{0, 0},    /*  stage 0 : No EQ(NO INPUT)  */
	{1, 0},    /*  stage 1 : 0~50M(short)  */
	{1, 0},    /*  stage 2 : 50~150M  */
	{1, 0},    /*  stage 3 : 150~250M  */
	{1, 0},    /*  stage 4 : 250~350M  */
	{1821, 0}, /*  stage 5 : 350~450M  */
	{2046, 0}, /*  stage 6 : 450~550M  */
};

static const int s_eq_cvi_re_table_720P50[7][2] = {
	{0, 0},    /*  stage 0 : No EQ(NO INPUT)  */
	{1, 0},    /*  stage 1 : 0~50M(short)  */
	{1, 0},    /*  stage 2 : 50~150M  */
	{1, 0},    /*  stage 3 : 150~250M  */
	{1, 0},    /*  stage 4 : 250~350M  */
	{1, 0},    /*  stage 5 : 350~450M  */
	{2046, 0}, /*  stage 6 : 450~550M  */
};

static const int s_eq_cvi_re_table_720P60[7][2] = {
	{0, 0},    /*  stage 0 : No EQ(NO INPUT)  */
	{1, 0},    /*  stage 1 : 0~50M(short)  */
	{1, 0},    /*  stage 2 : 50~150M  */
	{1, 0},    /*  stage 3 : 150~250M  */
	{1, 0},    /*  stage 4 : 250~350M  */
	{1, 0},    /*  stage 5 : 350~450M  */
	{2046, 0}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_1080p2550[7][2] = {
	/* Y SUM, UTP  */
	{0, 0},     /*  stage 0 : No EQ(NO INPUT)  */
	{371, 380}, /*  stage 1 : 0~50M(short)  */
	{291, 280}, /*  stage 2 : 50~150M  */
	{223, 210}, /*  stage 3 : 150~250M  */
	{179, 150}, /*  stage 4 : 250~350M  */
	{146, 135}, /*  stage 5 : 350~450M  */
	{132, 93},  /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_1080p3060[7][2] = {
	/* Y SUM, UTP  */
	{0, 0},     /*  stage 0 : No EQ(NO INPUT)  */
	{387, 350}, /*  stage 1 : 0~50M(short)  */
	{301, 270}, /*  stage 2 : 50~150M  */
	{227, 200}, /*  stage 3 : 150~250M  */
	{181, 170}, /*  stage 4 : 250~350M  */
	{150, 90},  /*  stage 5 : 350~450M  */
	{137, 0},   /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_720p2550[7][2] = {
	/* Y SUM, UTP  */
	{0, 0},     /*  stage 0 : No EQ(NO INPUT)  */
	{568, 440}, /*  stage 1 : 0~50M(short)  */
	{471, 335}, /*  stage 2 : 50~150M  */
	{397, 290}, /*  stage 3 : 150~250M  */
	{339, 245}, /*  stage 4 : 250~350M  */
	{293, 200}, /*  stage 5 : 350~450M  */
	{272, 0},   /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_720p3060[7][2] = {
	/* Y SUM, UTP  */
	{0, 0},     /*  stage 0 : No EQ(NO INPUT)  */
	{560, 370}, /*  stage 1 : 0~50M(short)  */
	{450, 300}, /*  stage 2 : 50~150M  */
	{380, 240}, /*  stage 3 : 150~250M  */
	{310, 217}, /*  stage 4 : 250~350M  */
	{270, 180}, /*  stage 5 : 350~450M  */
	{230, 0},   /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_720p2550_gain[7][2] = {
	/* Y SUM,  UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{178, 196},   /*  stage 1 : 0~50M(short)  */
	{285, 430},   /*  stage 2 : 50~150M  */
	{457, 1050},  /*  stage 3 : 150~250M  */
	{637, 1051},  /*  stage 4 : 250~350M  */
	{1073, 2046}, /*  stage 5 : 350~450M  */
	{1600, 2046}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_720p3060_gain[7][2] = {
	/* Y SUM,  UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{159, 196},   /*  stage 1 : 0~50M(short)  */
	{249, 430},   /*  stage 2 : 50~150M  */
	{365, 1050},  /*  stage 3 : 150~250M  */
	{591, 1051},  /*  stage 4 : 250~350M  */
	{1086, 2046}, /*  stage 5 : 350~450M  */
	{1600, 2046}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_chd_1080p30[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{78, 230},    /*  stage 1 : 0~50M(short)  */
	{209, 450},   /*  stage 2 : 50~150M  */
	{451, 1400},  /*  stage 3 : 150~250M  */
	{1026, 2047}, /*  stage 4 : 250~350M  */
	{1753, 2047}, /*  stage 5 : 350~450M  */
	{2046, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_chd_1080p25[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{78, 230},    /*  stage 1 : 0~50M(short)  */
	{206, 450},   /*  stage 2 : 50~150M  */
	{441, 1400},  /*  stage 3 : 150~250M  */
	{1030, 2047}, /*  stage 4 : 250~350M  */
	{1764, 2047}, /*  stage 5 : 350~450M  */
	{2046, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_chd_720p30[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{57, 140},    /*  stage 1 : 0~50M(short)  */
	{110, 320},   /*  stage 2 : 50~150M  */
	{219, 900},   /*  stage 3 : 150~250M  */
	{443, 1600},  /*  stage 4 : 250~350M  */
	{860, 2047},  /*  stage 5 : 350~450M  */
	{1500, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_chd_720p60[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{225, 850},   /*  stage 1 : 0~50M(short)  */
	{561, 1200},  /*  stage 2 : 50~150M  */
	{1400, 1600}, /*  stage 3 : 150~250M  */
	{1701, 2047}, /*  stage 4 : 250~350M  */
	{1801, 2047}, /*  stage 5 : 350~450M  */
	{1801, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_chd_720p25[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{59, 140},    /*  stage 1 : 0~50M(short)  */
	{110, 320},   /*  stage 2 : 50~150M  */
	{216, 900},   /*  stage 3 : 150~250M  */
	{440, 1600},  /*  stage 4 : 250~350M  */
	{865, 2047},  /*  stage 5 : 350~450M  */
	{1450, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_chd_720p50[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{240, 550},   /*  stage 1 : 0~50M(short)  */
	{592, 850},   /*  stage 2 : 50~150M  */
	{1450, 1600}, /*  stage 3 : 150~250M  */
	{1701, 2047}, /*  stage 4 : 250~350M  */
	{1801, 2047}, /*  stage 5 : 350~450M  */
	{1801, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_thd_1080p25[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{188, 451},   /*  stage 1 : 0~50M(short)  */
	{717, 900},   /*  stage 2 : 50~150M  */
	{1500, 2047}, /*  stage 3 : 150~250M  */
	{1600, 2047}, /*  stage 4 : 250~350M  */
	{1701, 2047}, /*  stage 5 : 350~450M  */
	{1701, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_thd_1080p30[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{262, 451},   /*  stage 1 : 0~50M(short)  */
	{573, 900},   /*  stage 2 : 50~150M  */
	{1400, 2047}, /*  stage 3 : 150~250M  */
	{1500, 2047}, /*  stage 4 : 250~350M  */
	{1601, 2047}, /*  stage 5 : 350~450M  */
	{1601, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_thd_720p25A[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{196, 451},   /*  stage 1 : 0~50M(short)  */
	{662, 1600},  /*  stage 2 : 50~150M  */
	{1395, 2047}, /*  stage 3 : 150~250M  */
	{1950, 2047}, /*  stage 4 : 250~350M  */
	{2046, 2047}, /*  stage 5 : 350~450M  */
	{2046, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_thd_720p30A[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{184, 451},   /*  stage 1 : 0~50M(short)  */
	{517, 1600},  /*  stage 2 : 50~150M  */
	{1254, 2047}, /*  stage 3 : 150~250M  */
	{1632, 2047}, /*  stage 4 : 250~350M  */
	{1900, 2047}, /*  stage 5 : 350~450M  */
	{1901, 2047}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_thd_720p25B[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{126, 220},   /*  stage 1 : 0~50M(short)  */
	{241, 680},   /*  stage 2 : 50~150M  */
	{428, 1400},  /*  stage 3 : 150~250M  */
	{943, 1401},  /*  stage 4 : 250~350M  */
	{1699, 2046}, /*  stage 5 : 350~450M  */
	{1850, 2046}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_thd_720p30B[7][2] = {
	/* EQ pattern, UTP  */
	{0, 0},       /*  stage 0 : No EQ(NO INPUT)  */
	{125, 220},   /*  stage 1 : 0~50M(short)  */
	{240, 680},   /*  stage 2 : 50~150M  */
	{427, 1400},  /*  stage 3 : 150~250M  */
	{935, 2046},  /*  stage 4 : 250~350M  */
	{1691, 2046}, /*  stage 5 : 350~450M  */
	{1850, 2046}, /*  stage 6 : 450~550M  */
};
/*  AHD 3M 18P  */
static const int s_eq_distance_3m_18p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},   /*  stage 0 : No EQ(NO INPUT)  */
	{515, 0}, /*  stage 1 : 0~50M(short)  */
	{387, 0}, /*  stage 2 : 50~150M  */
	{300, 0}, /*  stage 3 : 150~250M  */
	{239, 0}, /*  stage 4 : 250~350M  */
	{194, 0}, /*  stage 5 : 350~450M  */
	{101, 0}, /*  stage 6 : 450~550M  */
};
/*  AHD 3M 25P  */
static const int s_eq_distance_3m_25p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},   /*  stage 0 : No EQ(NO INPUT)  */
	{460, 0}, /*  stage 1 : 0~50M(short)  */
	{315, 0}, /*  stage 2 : 50~150M  */
	{220, 0}, /*  stage 3 : 150~250M  */
	{160, 0}, /*  stage 4 : 250~350M  */
	{125, 0}, /*  stage 5 : 350~450M  */
	{80, 0},  /*  stage 6 : 450~550M  */
};
/*  AHD 3M 30P  */
static const int s_eq_distance_3m_30p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},   /*  stage 0 : No EQ(NO INPUT)  */
	{460, 0}, /*  stage 1 : 0~50M(short)  */
	{315, 0}, /*  stage 2 : 50~150M  */
	{220, 0}, /*  stage 3 : 150~250M  */
	{160, 0}, /*  stage 4 : 250~350M  */
	{125, 0}, /*  stage 5 : 350~450M  */
	{80, 0},  /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_thd_3m_18p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},    /*  stage 0 : No EQ(NO INPUT)  */
	{188, 0},  /*  stage 1 : 0~50M(short)  */
	{717, 0},  /*  stage 2 : 50~150M  */
	{1500, 0}, /*  stage 3 : 150~250M  */
	{1600, 0}, /*  stage 4 : 250~350M  */
	{1701, 0}, /*  stage 5 : 350~450M  */
	{1701, 0}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_thd_5m_18p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},    /*  stage 0 : No EQ(NO INPUT)  */
	{188, 0},  /*  stage 1 : 0~50M(short)  */
	{717, 0},  /*  stage 2 : 50~150M  */
	{1500, 0}, /*  stage 3 : 150~250M  */
	{1600, 0}, /*  stage 4 : 250~350M  */
	{1701, 0}, /*  stage 5 : 350~450M  */
	{1701, 0}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_4m_25p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},   /*  stage 0 : No EQ(NO INPUT)  */
	{460, 0}, /*  stage 1 : 0~50M(short)  */
	{315, 0}, /*  stage 2 : 50~150M  */
	{220, 0}, /*  stage 3 : 150~250M  */
	{160, 0}, /*  stage 4 : 250~350M  */
	{125, 0}, /*  stage 5 : 350~450M  */
	{80, 0},  /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_4m_30p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},   /*  stage 0 : No EQ(NO INPUT)  */
	{460, 0}, /*  stage 1 : 0~50M(short)  */
	{315, 0}, /*  stage 2 : 50~150M  */
	{220, 0}, /*  stage 3 : 150~250M  */
	{160, 0}, /*  stage 4 : 250~350M  */
	{125, 0}, /*  stage 5 : 350~450M  */
	{80, 0},  /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_4m_nrt[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},   /*  stage 0 : No EQ(NO INPUT)  */
	{515, 0}, /*  stage 1 : 0~50M(short)  */
	{387, 0}, /*  stage 2 : 50~150M  */
	{300, 0}, /*  stage 3 : 150~250M  */
	{239, 0}, /*  stage 4 : 250~350M  */
	{194, 0}, /*  stage 5 : 350~450M  */
	{101, 0}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_5m_12_5p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},   /*  stage 0 : No EQ(NO INPUT)  */
	{515, 0}, /*  stage 1 : 0~50M(short)  */
	{387, 0}, /*  stage 2 : 50~150M  */
	{300, 0}, /*  stage 3 : 150~250M  */
	{239, 0}, /*  stage 4 : 250~350M  */
	{194, 0}, /*  stage 5 : 350~450M  */
	{101, 0}, /*  stage 6 : 450~550M  */
};

static const int s_eq_distance_5m_20p[7][2] = {
	/* EQ pattern, reserved */
	{0, 0},   /*  stage 0 : No EQ(NO INPUT)  */
	{460, 0}, /*  stage 1 : 0~50M(short)  */
	{315, 0}, /*  stage 2 : 50~150M  */
	{220, 0}, /*  stage 3 : 150~250M  */
	{160, 0}, /*  stage 4 : 250~350M  */
	{125, 0}, /*  stage 5 : 350~450M  */
	{80, 0},  /*  stage 6 : 450~550M  */
};
/* ******************************************************************************
 *
 *	This table is EQ distance table
 *  The customer can change this value according to the environment
 *  	- EQ_DEFAULT_STAGE_VAL : Nextchip default distance value
 *		- EQ_USER_STAGE_VAL    : Custormer distance value
 *		- EQ_H_DELAY_VAL	   : H delay value
 *		- EQ_recovery_val      : EQ Recovery start point value
 *		- EQ_recovery_val  	   : EQ Recovery end point value
 *		- Reserved value	   : Reserved value
 *		s_eq_distance_table[eq_tbl_num][0][EQ_DEFAULT_STAGE_VAL]
 *		s_eq_distance_table[eq_tbl_num][0][EQ_USER_STAGE_VAL]
 *		s_eq_distance_table[eq_tbl_num][0][EQ_H_DELAY_VAL]
 *		s_eq_distance_table[eq_tbl_num][0][EQ_S_RECERV_VAL]
 *		s_eq_distance_table[eq_tbl_num][0][EQ_E_RECERV_VAL]
 *		s_eq_distance_table[eq_tbl_num][0][RESERVED]
 *
 *			{
 *
 ****************************************************************************** */
#define ACC_MIN_MARGIN (0.9)
#define ACC_MAX_MARGIN (1.1)

/*  AFHD 25P, 50P  */
static const int s_eq_1080p2550[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa2, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_1080p2550[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_1080p2550[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_1080p2550[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8c, 0x50, 0x76, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x80, 0xDC, 0x57,
	 0xa8, 0x88, 0x09, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8c, 0x50, 0x76, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x80, 0xDC, 0x57,
	 0xa8, 0x82, 0x09, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x85, 0x70, 0x7e, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x87, 0xDC, 0x57,
	 0xa8, 0x7c, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x8b, 0x30, 0x7d, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x81, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x8b, 0x30, 0x7e, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x82, 0xDC, 0x57,
	 0xa8, 0x81, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x70, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x7b, 0xDC, 0x57,
	 0x70, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x20, 0x70, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x7d, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  AFHD 30P, 60P  */
static const int s_eq_1080p3060[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa2, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_1080p3060[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_1080p3060[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_1080p3060[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8c, 0x50, 0x76, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x80, 0xDC, 0x57,
	 0xa8, 0x88, 0x09, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8c, 0x50, 0x76, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x80, 0xDC, 0x57,
	 0xa8, 0x88, 0x09, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x85, 0x70, 0x7e, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x87, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x8b, 0x30, 0x7d, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x81, 0xDC, 0x57,
	 0xa8, 0x86, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x8b, 0x30, 0x7e, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x82, 0xDC, 0x57,
	 0xa8, 0x87, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x70, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x7b, 0xDC, 0x57,
	 0x70, 0x86, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x20, 0x70, 0xff, 0x10, 0x10, 0xf6, 0xf4, 0x7d, 0xDC, 0x57,
	 0x50, 0x86, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  AHD 25, 50P - no update yet  */
static const int s_eq_720p2550[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */
	/* stage 8 : 650M ~   */
};

static const int s_eq_A_coeff_720p2550[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/*  {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/*  {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_B_coeff_720p2550[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70},   */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, */ /*  stage 8 : 650M ~  */

};

static const int s_eq_color_720p2550[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8d, 0x20, 0x7b, 0x02, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8d, 0x20, 0x7b, 0x02, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x84, 0x40, 0x76, 0x02, 0x00, 0x00, 0xfc, 0xf6, 0x86, 0xDC, 0x57,
	 0xa8, 0x7d, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x8c, 0x40, 0x72, 0x02, 0x00, 0x00, 0xfc, 0xf6, 0x84, 0xDC, 0x57,
	 0xa8, 0x7a, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x8b, 0x40, 0x74, 0x02, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x75, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x84, 0x20, 0x76, 0x02, 0x00, 0x00, 0xfc, 0xf6, 0x88, 0xDC, 0x57,
	 0xa8, 0x77, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x84, 0x20, 0x76, 0x02, 0x00, 0x00, 0xfc, 0xf6, 0x88, 0xDC, 0x57,
	 0xa8, 0x79, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
	/*  {0x00,         0x8a,       0x20,     0x80,     0x02, 0x00,   0x00,  */
	/*  0xfc,     0xf6,     0x7c,        0xDC,     0x57,   0x90,    0x76,  */
	/*  0x08,      0,      2047,     0x00},  */ /*  stage 7 : 550~650M  */
	/*  {0x00,         0x8a,       0x20,     0x80,     0x02, 0x00,   0x00,  */
	/*  0xfc,     0xf6,     0x85,        0xDC,     0x57,   0x70,    0x73,  */
	/*  0x08,      0,      2047,     0x00}, */ /* stage 8 : 650M ~  */
};

/*  AHD 30, 60P - no update yet  */
static const int s_eq_720p3060[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */
	/* stage 8 : 650M ~  */
};

static const int s_eq_A_coeff_720p3060[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_B_coeff_720p3060[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70},  */ /*  stage 8 : 650M ~  */
};

static const int s_eq_color_720p3060[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8d, 0x20, 0x7b, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8d, 0x20, 0x7b, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0x7f, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x85, 0xDC, 0x57,
	 0xa8, 0x7d, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x40, 0x7e, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x84, 0xDC, 0x57,
	 0xa8, 0x7a, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x8a, 0x40, 0x7e, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x7e, 0xDC, 0x57,
	 0xa8, 0x73, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x82, 0x20, 0x76, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x84, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x83, 0x20, 0x76, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x86, 0xDC, 0x57,
	 0xa8, 0x7b, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
	/*  {0x00,         0x8a,       0x20,     0x80,     0x02, 0x00,   0x00,  */
	/*  0xfc,     0xf6,     0x7c,        0xDC,     0x57,   0x90,   0x76,  */
	/*  0x08,      0,      2047,     0x00},  */ /*  stage 7 : 550~650M  */
	/*  {0x00,         0x8a,       0x20,     0x80,     0x02, 0x00,   0x00,  */
	/*  0xfc,     0xf6,     0x85,        0xDC,     0x57,   0x70,   0x68,  */
	/*  0x08,      0,      2047,     0x00},  */ /*  stage 8 : 650M ~  */

};

/*  AHD 25, 50P NO LE version. - no update yet  */
static const int s_eq_720p2550_gain[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 8 : 650M ~   */

};

static const int s_eq_A_coeff_720p2550_gain[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_B_coeff_720p2550_gain[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70},  */ /*  stage 8 : 650M ~  */
};

static const int s_eq_color_720p2550_gain[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8d, 0x20, 0x7b, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8d, 0x20, 0x7b, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0x7f, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x85, 0xDC, 0x57,
	 0xa8, 0x7d, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x40, 0x7e, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x84, 0xDC, 0x57,
	 0xa8, 0x7a, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x8a, 0x40, 0x7e, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x7e, 0xDC, 0x57,
	 0xa8, 0x73, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x82, 0x20, 0x76, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x84, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x83, 0x20, 0x76, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x86, 0xDC, 0x57,
	 0xa8, 0x7b, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
	/*  {0x00,         0x8a,       0x20,     0x80,     0x02, 0x00,   0x00,  */
	/*  0xfc,     0xf6,     0x7c,        0xDC,     0x57,   0x90,   0x76,  */
	/*  0x08,      0,      2047,     0x00},  */ /*  stage 7 : 550~650M  */
	/*  {0x00,         0x8a,       0x20,     0x80,     0x02, 0x00,   0x00,  */
	/*  0xfc,     0xf6,     0x85,        0xDC,     0x57,   0x70,   0x68,  */
	/*  0x08,      0,      2047,     0x00},  */ /*  stage 8 : 650M ~  */
};

/*  AHD 30, 60P - no update yet  */
static const int s_eq_720p3060_gain[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 8 : 650M ~   */
};

static const int s_eq_A_coeff_720p3060_gain[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_B_coeff_720p3060_gain[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70},  */ /*  stage 8 : 650M ~  */
};

static const int s_eq_color_720p3060_gain[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8d, 0x20, 0x7b, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8d, 0x20, 0x7b, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0x7f, 0x01, 0x00, 0x00, 0xfc, 0xf6, 0x85, 0xDC, 0x57,
	 0xa8, 0x7d, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x40, 0x7e, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x84, 0xDC, 0x57,
	 0xa8, 0x7a, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x8a, 0x40, 0x7e, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x7e, 0xDC, 0x57,
	 0xa8, 0x73, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x82, 0x20, 0x76, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x84, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x83, 0x20, 0x76, 0x00, 0x00, 0x00, 0xfc, 0xf6, 0x86, 0xDC, 0x57,
	 0xa8, 0x7b, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
	/*  {0x00,         0x8a,       0x20,     0x80,     0x02, 0x00,   0x00,  */
	/*  0xfc,     0xf6,     0x7c,        0xDC,     0x57,   0x90,   0x76,  */
	/*  0x08,      0,      2047,     0x00},  */ /*  stage 7 : 550~650M  */
	/*  {0x00,         0x8a,       0x20,     0x80,     0x02, 0x00,   0x00,  */
	/*  0xfc,     0xf6,     0x85,        0xDC,     0x57,   0x70,   0x68,  */
	/*  0x08,      0,      2047,     0x00},  */ /*  stage 8 : 650M ~  */
};

#ifdef SUPPORT_HI3520D
/*  CFHD 30P - no update yet . now, HI3531A CVI 1080@30p value  */
static const int s_eq_chd_1080p30[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_A_coeff_1080p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_B_coeff_1080p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_1080p30[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8b, 0x20, 0x83, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x20, 0x83, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8b, 0x20, 0x83, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x84, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x87, 0x00, 0x82, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x8d, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x84, 0x00, 0x73, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x88, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8c, 0x00, 0x76, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x7f, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x00, 0x70, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x83, 0xDC, 0x57,
	 0x30, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

#else
/*  CFHD 30P  */
static const int s_eq_chd_1080p30[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_A_coeff_1080p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_B_coeff_1080p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_1080p30[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8b, 0x20, 0x83, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x20, 0x83, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x80, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8b, 0x20, 0x83, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x84, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x87, 0x00, 0x82, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x8d, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x84, 0x00, 0x73, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x88, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8c, 0x00, 0x76, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x7f, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x00, 0x70, 0x21, 0x00, 0x08, 0xfa, 0xf5, 0x83, 0xDC, 0x57,
	 0x30, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};
#endif

#ifdef SUPPORT_HI3520D
/*  CFHD 25P - no update yet . now, HI3531A CVI 1080@30p value  */
static const int s_eq_chd_1080p25[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_A_coeff_1080p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_B_coeff_1080p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_1080p25[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8c, 0x20, 0x83, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x7e, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8c, 0x20, 0x85, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x7e, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8c, 0x20, 0x85, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x82, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x00, 0x84, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x85, 0x00, 0x75, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x86, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8d, 0x00, 0x78, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x7d, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8b, 0x00, 0x72, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x81, 0xDC, 0x57,
	 0x30, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};
#else
/*  CFHD 25P - no update yet . now, HI3531A CVI 1080@30p value  */
static const int s_eq_chd_1080p25[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_A_coeff_1080p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_B_coeff_1080p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_1080p25[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8c, 0x20, 0x83, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x7e, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8c, 0x20, 0x85, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x7e, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8c, 0x20, 0x85, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x82, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x00, 0x84, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x85, 0x00, 0x75, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x86, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8d, 0x00, 0x78, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x7d, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8b, 0x00, 0x72, 0x20, 0x00, 0x08, 0xfa, 0xf5, 0x81, 0xDC, 0x57,
	 0x30, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};
#endif

#ifdef SUPPORT_HI3520D
/*  CHD 30P - no update yet . now, HI3531A CVI 720@30p value  */
static const int s_eq_chd_720p30[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 8 : 650M ~   */
};

static const int s_eq_chd_A_coeff_720p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_chd_B_coeff_720p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_720p30[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x08, 0x8c, 0x20, 0x84, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x08, 0x8c, 0x20, 0x84, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x08, 0x87, 0x20, 0x88, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8c, 0xDC, 0x57,
	 0xa8, 0x7d, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x08, 0x87, 0x40, 0x87, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0x7a, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x08, 0x89, 0x40, 0x87, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x85, 0xDC, 0x57,
	 0xa8, 0x73, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x08, 0x81, 0x20, 0x7f, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa0, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x08, 0x82, 0x20, 0x7f, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8d, 0xDC, 0x57,
	 0x90, 0x7b, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

#else
/*  CHD 30P - no update yet .  */
static const int s_eq_chd_720p30[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 8 : 650M ~   */
};

static const int s_eq_chd_A_coeff_720p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_chd_B_coeff_720p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_720p30[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x08, 0x8c, 0x20, 0x84, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x08, 0x8c, 0x20, 0x84, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x08, 0x87, 0x20, 0x88, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8c, 0xDC, 0x57,
	 0xa8, 0x7d, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x08, 0x87, 0x40, 0x87, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0x7a, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x08, 0x89, 0x40, 0x87, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x85, 0xDC, 0x57,
	 0xa8, 0x73, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x08, 0x81, 0x20, 0x7f, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa0, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x08, 0x82, 0x20, 0x7f, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8d, 0xDC, 0x57,
	 0x90, 0x7b, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};
#endif

#ifdef SUPPORT_HI3520D
/*  CHD 25P - no update yet . now, HI3531A CVI 720@25p value  */
static const int s_eq_chd_720p25[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 8 : 650M ~   */
};

static const int s_eq_chd_A_coeff_720p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_chd_B_coeff_720p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_chd_color_720p25[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x08, 0x8a, 0x20, 0x84, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0xd0, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x08, 0x8a, 0x20, 0x84, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0xd0, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x08, 0x85, 0x20, 0x88, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8c, 0xDC, 0x57,
	 0xa8, 0xcd, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x08, 0x85, 0x40, 0x87, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0xca, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x08, 0x87, 0x40, 0x87, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x85, 0xDC, 0x57,
	 0xa8, 0xc3, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x08, 0x7f, 0x20, 0x7f, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa0, 0xd2, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x08, 0x80, 0x20, 0x7f, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8d, 0xDC, 0x57,
	 0x90, 0xcb, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

#else
/*  CHD 25P - no update yet .  */
static const int s_eq_chd_720p25[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 8 : 650M ~   */
};

static const int s_eq_chd_A_coeff_720p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_chd_B_coeff_720p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_chd_color_720p25[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x08, 0x8a, 0x20, 0x84, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0xd0, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x08, 0x8a, 0x20, 0x84, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0xd0, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x08, 0x85, 0x20, 0x88, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8c, 0xDC, 0x57,
	 0xa8, 0xcd, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x08, 0x85, 0x40, 0x87, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0xca, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x08, 0x87, 0x40, 0x87, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x85, 0xDC, 0x57,
	 0xa8, 0xc3, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x08, 0x7f, 0x20, 0x7f, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa0, 0xd2, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x08, 0x80, 0x20, 0x7f, 0x33, 0x00, 0x00, 0xfa, 0xf5, 0x8d, 0xDC, 0x57,
	 0x90, 0xcb, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

#endif

#ifdef SUPPORT_HI3520D
/*  CHD 60P - no update yet . now, HI3531A CVI 720@60p value  */
static const int s_eq_chd_720p60[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_A_coeff_720p60[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_B_coeff_720p60[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_720p60[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x08, 0x88, 0x00, 0x83, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x94, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x08, 0x85, 0x00, 0x74, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8f, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x08, 0x8d, 0x00, 0x77, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x86, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x08, 0x8b, 0x20, 0x70, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8a, 0xDC, 0x57,
	 0x30, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

#else
/*  CHD 60P - no update yet .  */
static const int s_eq_chd_720p60[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_A_coeff_720p60[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_B_coeff_720p60[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_720p60[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x08, 0x88, 0x00, 0x83, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x94, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x08, 0x85, 0x00, 0x74, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8f, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x08, 0x8d, 0x00, 0x77, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x86, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x08, 0x8b, 0x20, 0x70, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8a, 0xDC, 0x57,
	 0x30, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

#endif

#ifdef SUPPORT_HI3520D
/*  CHD 50P - no update yet . now, HI3531A CVI 720@50p value  */
static const int s_eq_chd_720p50[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_A_coeff_720p50[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_B_coeff_720p50[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_720p50[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x08, 0x88, 0x00, 0x83, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x94, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x08, 0x85, 0x00, 0x74, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8f, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x08, 0x8d, 0x00, 0x77, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x86, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x08, 0x8b, 0x20, 0x70, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8a, 0xDC, 0x57,
	 0x30, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

#else
/*  CHD 50P - no update yet .  */
static const int s_eq_chd_720p50[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_A_coeff_720p50[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_B_coeff_720p50[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_chd_color_720p50[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x87, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x08, 0x8c, 0x20, 0x84, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8b, 0xDC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x08, 0x88, 0x00, 0x83, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x94, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x08, 0x85, 0x00, 0x74, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8f, 0xDC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x08, 0x8d, 0x00, 0x77, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x86, 0xDC, 0x57,
	 0x50, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x08, 0x8b, 0x20, 0x70, 0x2c, 0x00, 0x00, 0xfa, 0xf5, 0x8a, 0xDC, 0x57,
	 0x30, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};
#endif

/*  TFHD 25 - no update yet. TFHD 30p value */
static const int s_eq_thd_1080p25[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_A_coeff_1080p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_B_coeff_1080p25[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_color_1080p25[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8e, 0x30, 0x8a, 0xff, 0x04, 0x08, 0xfb, 0xf8, 0x80, 0xCC, 0x57,
	 0xa8, 0x50, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x91, 0x30, 0x8a, 0xff, 0x08, 0x08, 0xfb, 0xf8, 0x80, 0xCC, 0x57,
	 0xa8, 0x50, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8f, 0x30, 0x93, 0xff, 0x08, 0x08, 0xfb, 0xf8, 0x84, 0xCC, 0x57,
	 0xa8, 0x4e, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x8e, 0x30, 0x89, 0xff, 0x08, 0x08, 0xfb, 0xf8, 0x82, 0xCC, 0x57,
	 0xa8, 0x56, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x87, 0x00, 0x73, 0xff, 0x08, 0x08, 0xfb, 0xf8, 0x82, 0xCC, 0x57,
	 0xa8, 0x54, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x89, 0x00, 0x73, 0xff, 0x08, 0x08, 0xfb, 0xf8, 0x7f, 0xCC, 0x57,
	 0x50, 0x52, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x87, 0x00, 0x73, 0xff, 0x08, 0x08, 0xfb, 0xf8, 0x83, 0xCC, 0x57,
	 0x30, 0x4f, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  TFHD 30  */
static const int s_eq_thd_1080p30[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_A_coeff_1080p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_B_coeff_1080p30[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_color_1080p30[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8e, 0x70, 0x87, 0xff, 0x04, 0x08, 0xfb, 0xf8, 0x80, 0xCC, 0x57,
	 0xa8, 0x50, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8e, 0x70, 0x87, 0xff, 0x04, 0x08, 0xfb, 0xf8, 0x80, 0xCC, 0x57,
	 0xa8, 0x50, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8c, 0x30, 0x90, 0xff, 0x04, 0x08, 0xfb, 0xf8, 0x84, 0xCC, 0x57,
	 0xa8, 0x4e, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x8b, 0x30, 0x86, 0xff, 0x04, 0x08, 0xfb, 0xf8, 0x82, 0xCC, 0x57,
	 0xa8, 0x56, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x84, 0x00, 0x70, 0xff, 0x04, 0x08, 0xfb, 0xf8, 0x82, 0xCC, 0x57,
	 0xa8, 0x54, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x86, 0x00, 0x70, 0xff, 0x04, 0x08, 0xfb, 0xf8, 0x7f, 0xCC, 0x57,
	 0x50, 0x52, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x84, 0x00, 0x70, 0xff, 0x04, 0x08, 0xfb, 0xf8, 0x83, 0xCC, 0x57,
	 0x30, 0x4f, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  THD A(25) - no update yet. */
static const int s_eq_thd_720p25A[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_A_coeff_720p25A[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_B_coeff_720p25A[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_color_720p25A[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8b, 0x20, 0x83, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x80, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x20, 0x83, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x80, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8b, 0x00, 0x83, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x84, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x87, 0x00, 0x82, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x8d, 0xCC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x00, 0x76, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x84, 0xCC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8c, 0x00, 0x76, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x7f, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x00, 0x70, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x83, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  THD A(30) - no update yet. */
static const int s_eq_thd_720p30A[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_A_coeff_720p30A[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_B_coeff_720p30A[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_color_720p30A[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8b, 0x20, 0x83, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x80, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x20, 0x83, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x80, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8b, 0x00, 0x83, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x84, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x87, 0x00, 0x82, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x8d, 0xCC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x00, 0x76, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x84, 0xCC, 0x57,
	 0xa8, 0x82, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8c, 0x00, 0x76, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x7f, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x00, 0x70, 0x02, 0x00, 0x08, 0xfa, 0xf5, 0x83, 0xCC, 0x57,
	 0xa8, 0x80, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  THD B(25) - no update yet. */
static const int s_eq_thd_720p25B[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 8 : 650M ~   */
};

static const int s_eq_thd_A_coeff_720p25B[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_thd_B_coeff_720p25B[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_thd_color_720p25B[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x84, 0x20, 0x94, 0x02, 0x20, 0x07, 0xf3, 0xfa, 0x87, 0xCC, 0x57,
	 0xa8, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x84, 0x20, 0x94, 0x02, 0x20, 0x07, 0xf3, 0xfa, 0x87, 0xCC, 0x57,
	 0xa8, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x7f, 0x30, 0x98, 0x02, 0x20, 0x07, 0xf3, 0xfa, 0x8c, 0xCC, 0x57,
	 0xa8, 0x81, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x7f, 0x40, 0x97, 0x02, 0x20, 0x07, 0xf3, 0xfa, 0x8b, 0xCC, 0x57,
	 0xa8, 0x7e, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x81, 0x40, 0x97, 0x02, 0x20, 0x07, 0xf3, 0xfa, 0x86, 0xCC, 0x57,
	 0xa8, 0x75, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x88, 0x30, 0x8f, 0x02, 0x20, 0x07, 0xf3, 0xfa, 0x8b, 0xCC, 0x57,
	 0xa0, 0x86, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x89, 0x20, 0x8f, 0x02, 0x20, 0x07, 0xf3, 0xfa, 0x8d, 0xCC, 0x57,
	 0x90, 0x7f, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  THD B(30) - no update yet. */
static const int s_eq_thd_720p30B[7][8] = {
	/* AEQ, DEQ1, DEQ2,  G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0xa3, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xd3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xc3, 0xa1, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x93, 0xa7, 0xa7,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 7 : 550~650M  */
	/* {0x33, 0xa1, 0xa2,   0x00,  0x03,     0x00,     0x03,      0x00},  */ /*   */
	/* stage 8 : 650M ~   */
};

static const int s_eq_thd_A_coeff_720p30B[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_thd_B_coeff_720p30B[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 6 : 450~550M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 7 : 550~650M  */
	/* {0x01,  0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3},  */ /*  stage 8 : 650M~  */
};

static const int s_eq_thd_color_720p30B[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x84, 0x20, 0x94, 0x02, 0x20, 0xfe, 0xf3, 0xf6, 0x80, 0xCC, 0x57,
	 0xa8, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8a, 0x20, 0x94, 0x02, 0x20, 0xfe, 0xf3, 0xf6, 0x80, 0xCC, 0x57,
	 0xa8, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x7f, 0x30, 0x98, 0x02, 0x20, 0xfe, 0xf3, 0xf6, 0x86, 0xCC, 0x57,
	 0xa8, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x7f, 0x40, 0x97, 0x02, 0x20, 0xfe, 0xf3, 0xf6, 0x85, 0xCC, 0x57,
	 0xa8, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x81, 0x40, 0x97, 0x02, 0x20, 0xfe, 0xf3, 0xf6, 0x7f, 0xCC, 0x57,
	 0xa8, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x88, 0x30, 0x8f, 0x02, 0x20, 0xfe, 0xf3, 0xf6, 0x84, 0xCC, 0x57,
	 0xa0, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x89, 0x20, 0x8f, 0x02, 0x20, 0xfe, 0xf3, 0xf6, 0x86, 0xCC, 0x57,
	 0x90, 0x84, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  AHD 3M 18P - no update yet */
static const int s_eq_3m_18p[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xd3, 0x00, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xd3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_3m_18p[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_3m_18p[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_3m_18p[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8c, 0x30, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x80, 0xDC, 0x57,
	 0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x30, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	 0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0xbe, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x8c, 0xDC, 0x57,
	 0xa8, 0x8e, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x30, 0xbe, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x8c, 0xDC, 0x57,
	 0xa8, 0x88, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x30, 0xbe, 0x01, 0x00, 0x05, 0xfa, 0xf9, 0x84, 0xDC, 0x57,
	 0xa8, 0x8b, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x70, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	 0x70, 0x87, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x70, 0x70, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x7d, 0xDC, 0x57,
	 0x50, 0x86, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  AHD 3M 25P - no update yet */
static const int s_eq_3m_25p[7][8] = {
	/* AEQ, DEQ1, DEQ2,, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_3m_25p[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 5 : 350~450M  */
	{0x01, 0x10, 0x29, 0x7b, 0xf0, 0x00, 0x49}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_3m_25p[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x0c, 0xe6, 0xfb, 0x00, 0xd8}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_3m_25p[7][18] = {
	/* brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	   u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	   yc_delay, acc_min, acc_max, reserved */
	{0x00, 0x8b, 0x20, 0x90, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	 0xa8, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x30, 0x90, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	 0xa8, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0xbD, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x8a, 0xDC, 0x57,
	 0xa8, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x40, 0xaA, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x8a, 0xDC, 0x57,
	 0xa8, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x20, 0x9A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x82, 0xDC, 0x57,
	 0x90, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x7A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	 0x70, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x40, 0x5A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x7b, 0xDC, 0x57,
	 0x60, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  AHD 3M 30P - no update yet */
static const int s_eq_3m_30p[7][8] = {
	/* AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_3m_30p[7][7] = {
	/* A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 5 : 350~450M  */
	{0x01, 0x10, 0x29, 0x7b, 0xf0, 0x00, 0x49}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_3m_30p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x0c, 0xe6, 0xfb, 0x00, 0xd8}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_3m_30p[7][18] = {
	/*  brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	yc_delay, acc_min, acc_max, reserved  */
	{0x00, 0x8b, 0x20, 0x90, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0xa8, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x30, 0x90, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0xa8, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0xbD, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x8a, 0xDC, 0x57,
	0xa8, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x40, 0xaA, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x8a, 0xDC, 0x57,
	0xa8, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x20, 0x9A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x82, 0xDC, 0x57,
	0x90, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x7A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0x70, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x40, 0x5A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x7b, 0xDC, 0x57,
	0x60, 0x5e, 0x07, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  THD 3M 18P - no update yet */
static const int s_eq_thd_3m_18p[7][8] = {
	/*  AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa7, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xc3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_A_coeff_3m_18p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_B_coeff_3m_18p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_color_3m_18p[7][18] = {
	/*  brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	yc_delay, acc_min, acc_max, reserved  */
	{0x00, 0x86, 0x40, 0x9F, 0x08, 0xF3, 0x00, 0xFD, 0xF8, 0x80, 0xDC, 0x57,
	0xa8, 0x64, 0x00, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x86, 0x40, 0x9F, 0x08, 0xF3, 0x00, 0xFD, 0xF8, 0x80, 0xDC, 0x57,
	0xa8, 0x64, 0x00, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x84, 0x20, 0xa8, 0x08, 0xF3, 0x00, 0xFD, 0xF8, 0x84, 0xDC, 0x57,
	0xa8, 0x62, 0x00, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x83, 0x20, 0x9e, 0x08, 0xF3, 0x00, 0xFD, 0xF8, 0x82, 0xDC, 0x57,
	0xa8, 0x6a, 0x00, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x7c, 0x00, 0x88, 0x08, 0xF3, 0x00, 0xFD, 0xF8, 0x82, 0xDC, 0x57,
	0xa8, 0x68, 0x00, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x7e, 0x00, 0x88, 0x08, 0xF3, 0x00, 0xFD, 0xF8, 0x7f, 0xDC, 0x57,
	0x50, 0x66, 0x00, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x80, 0x00, 0x88, 0x08, 0xF3, 0x00, 0xFD, 0xF8, 0x83, 0xDC, 0x57,
	0x30, 0x63, 0x00, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/*  THD 5M 18P - no update yet */
static const int s_eq_thd_5m_18p[7][8] = {
	/*  AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_A_coeff_5m_18p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_B_coeff_5m_18p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_thd_color_5m_18p[7][18] = {
	/*  brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	yc_delay, acc_min, acc_max, reserved  */
	{0x00, 0x8b, 0x20, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x20, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x8b, 0x20, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x8b, 0x20, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x8b, 0x20, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8b, 0x20, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_4m_25p[7][8] = {
	/*  AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_4m_25p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 5 : 350~450M  */
	{0x01, 0x10, 0x29, 0x7b, 0xf0, 0x00, 0x49}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_4m_25p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x0c, 0xe6, 0xfb, 0x00, 0xd8}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_4m_25p[7][18] = {
	/*  brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	yc_delay, acc_min, acc_max, reserved  */
	{0x00, 0x8b, 0x20, 0x90, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0xa8, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x30, 0x90, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0xa8, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0xbD, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x8a, 0xDC, 0x57,
	0xa8, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x40, 0xaA, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x8a, 0xDC, 0x57,
	0xa8, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x20, 0x9A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x82, 0xDC, 0x57,
	0x90, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x7A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0x70, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x40, 0x5A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x7b, 0xDC, 0x57,
	0x60, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_4m_30p[7][8] = {
	/*  AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_4m_30p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 5 : 350~450M  */
	{0x01, 0x10, 0x29, 0x7b, 0xf0, 0x00, 0x49}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_4m_30p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x0c, 0xe6, 0xfb, 0x00, 0xd8}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_4m_30p[7][18] = {
	/*  brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	yc_delay, acc_min, acc_max, reserved  */
	{0x00, 0x8b, 0x20, 0x90, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0xa8, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x30, 0x90, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0xa8, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0xbD, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x8a, 0xDC, 0x57,
	0xa8, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x40, 0xaA, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x8a, 0xDC, 0x57,
	0xa8, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x20, 0x9A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x82, 0xDC, 0x57,
	0x90, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x7A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x80, 0xDC, 0x57,
	0x70, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x40, 0x5A, 0xfe, 0x00, 0x07, 0xfb, 0xfb, 0x7b, 0xDC, 0x57,
	0x60, 0x2A, 0x07, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_4m_nrt[7][8] = {
	/*  AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xd3, 0x00, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xd3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_4m_nrt[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_4m_nrt[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_4m_nrt[7][18] = {
	/*  brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	yc_delay, acc_min, acc_max, reserved  */
	{0x00, 0x8c, 0x30, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x80, 0xDC, 0x57,
	0xa8, 0x60, 0x09, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x30, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x60, 0x09, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0xbe, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x8c, 0xDC, 0x57,
	0xa8, 0x60, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x30, 0xbe, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x8c, 0xDC, 0x57,
	0xa8, 0x60, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x30, 0xbe, 0x01, 0x00, 0x05, 0xfa, 0xf9, 0x84, 0xDC, 0x57,
	0xa8, 0x60, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x70, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0x70, 0x60, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x70, 0x70, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x7d, 0xDC, 0x57,
	0x50, 0x60, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_5m_12_5p[7][8] = {
	/*  AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa1, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0xd3, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xd3, 0x00, 0xa1, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0xd3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_5m_12_5p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x40, 0x00, 0xe2, 0xf9, 0x00, 0xe0}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x04, 0xf4, 0xfd, 0x02, 0xf3}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_5m_12_5p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 4 : 250~350M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 5 : 350~450M  */
	{0x01, 0x90, 0x7e, 0x7b, 0xe3, 0x47, 0x70}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_5m_12_5p[7][18] = {
	/*  brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub, H_delay,
	yc_delay, acc_min, acc_max, reserved  */
	{0x00, 0x8c, 0x30, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x80, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x30, 0x83, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0xa8, 0x90, 0x09, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0xbe, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x8c, 0xDC, 0x57,
	0xa8, 0x8e, 0x08, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x30, 0xbe, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x8c, 0xDC, 0x57,
	0xa8, 0x88, 0x08, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x30, 0xbe, 0x01, 0x00, 0x05, 0xfa, 0xf9, 0x84, 0xDC, 0x57,
	0xa8, 0x8b, 0x08, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x70, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x82, 0xDC, 0x57,
	0x70, 0x87, 0x08, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x70, 0x70, 0x00, 0x00, 0x05, 0xfa, 0xf9, 0x7d, 0xDC, 0x57,
	0x50, 0x86, 0x08, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_5m_20p[7][8] = {
	/*  AEQ, DEQ1, DEQ2, G_SEL, B_LPF, LPF_BYPASS, REF_VOLT, reserved  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03,
	0x00}, /*  stage 1 : 0~50M(short)  */
	{0x03, 0xa2, 0xa2, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 2 : 50~150M  */
	{0x03, 0xa2, 0xa3, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 3 : 150~250M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 4 : 250~350M  */
	{0xf3, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 5 : 350~450M  */
	{0x93, 0xa7, 0xa7, 0x00, 0x03, 0x00, 0x03, 0x00}, /*  stage 6 : 450~550M  */
};

static const int s_eq_A_coeff_5m_20p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x08, 0xe3, 0xfc, 0x00, 0xd6}, /*  stage 5 : 350~450M  */
	{0x01, 0x10, 0x29, 0x7b, 0xf0, 0x00, 0x49}, /*  stage 6 : 450~550M  */
};

static const int s_eq_B_coeff_5m_20p[7][7] = {
	/*  A0[8], A0,   A1,   A2,   B0,   B1,   B2   */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x01, 0x10, 0x64, 0x7b, 0xff, 0x00, 0x10}, /*  stage 2 : 50~150M  */
	{0x01, 0xc0, 0x7d, 0x50, 0xe1, 0x00, 0x30}, /*  stage 3 : 150~250M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 4 : 250~350M  */
	{0x01, 0x00, 0x0c, 0xe6, 0xfb, 0x00, 0xd4}, /*  stage 5 : 350~450M  */
	{0x01, 0x20, 0x0c, 0xe6, 0xfb, 0x00, 0xd8}, /*  stage 6 : 450~550M  */
};

static const int s_eq_color_5m_20p[7][18] = {
	/*  brightness, contrast, h_peaking, saturation, hue, u_gain, v_gain,
	u_offset, v_offset, black_level, fsc_mode, acc_ref, sat_sub,H_delay,
	yc_delay, acc_min, acc_max, reserved  */
	{0x00, 0x8b, 0x20, 0x85, 0xfe, 0x00, 0x07, 0xfc, 0xfb, 0x82, 0xDC, 0x57,
	0xa8, 0x80, 0x07, 0, 2047, 0x00}, /*  stage 0 : No EQ(NO INPUT)  */
	{0x00, 0x8b, 0x30, 0x85, 0xfe, 0x00, 0x07, 0xfc, 0xfb, 0x82, 0xDC, 0x57,
	0xa8, 0x80, 0x07, 0, 2047, 0x00}, /*  stage 1 : 0~50M(short)  */
	{0x00, 0x88, 0x30, 0xb4, 0xfe, 0x00, 0x07, 0xfc, 0xfb, 0x8c, 0xDC, 0x57,
	0xa8, 0x80, 0x07, 0, 2047, 0x00}, /*  stage 2 : 50~150M  */
	{0x00, 0x88, 0x40, 0xa0, 0xfe, 0x00, 0x07, 0xfc, 0xfb, 0x8c, 0xDC, 0x57,
	0xa8, 0x80, 0x07, 0, 2047, 0x00}, /*  stage 3 : 150~250M  */
	{0x00, 0x88, 0x20, 0x90, 0xfe, 0x00, 0x07, 0xfc, 0xfb, 0x84, 0xDC, 0x57,
	0x90, 0x80, 0x07, 0, 2047, 0x00}, /*  stage 4 : 250~350M  */
	{0x00, 0x8b, 0x20, 0x70, 0xfe, 0x00, 0x07, 0xfc, 0xfb, 0x82, 0xDC, 0x57,
	0x70, 0x80, 0x07, 0, 2047, 0x00}, /*  stage 5 : 350~450M  */
	{0x00, 0x8a, 0x40, 0x50, 0xfe, 0x00, 0x07, 0xfc, 0xfb, 0x7d, 0xDC, 0x57,
	0x60, 0x80, 0x07, 0, 2047, 0x00}, /*  stage 6 : 450~550M  */
};

/* ******************************************************************************
 *
 *
 *
 *  Functions(Common)
 *
 *
 *
 ****************************************************************************** */
/* *****************************************************************************
*	Description		: Get EQ pattern color gain
*	Argurments		: ch : channel number
*	Return value	: EQ pattern color gain value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned int GetAccGain(unsigned char ch)
{
	unsigned int acc_gain_status;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	acc_gain_status = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE2) & 0x07;
	acc_gain_status <<= 8;
	acc_gain_status |= gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE3);
	return acc_gain_status;
}

/* *****************************************************************************
*	Description		: Get Y plus slope
*	Argurments		: ch : channel number
*	Return value	: Y plus slope value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned int GetYPlusSlope(unsigned char ch)
{
	unsigned int y_plus_slp_status;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	y_plus_slp_status =
	    gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE8) & 0x07;
	y_plus_slp_status <<= 8;
	y_plus_slp_status |= gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE9);

	return y_plus_slp_status;
}

/* *****************************************************************************
*	Description		: Get Y minus slope
*	Argurments		: ch : channel number
*	Return value	: Y minus slope value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned int GetYMinusSlope(unsigned char ch)
{
	unsigned int y_minus_slp_status;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	y_minus_slp_status =
	    gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xEA) & 0x07;
	y_minus_slp_status <<= 8;
	y_minus_slp_status |= gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xEB);

	return y_minus_slp_status;
}

/* *****************************************************************************
*	Description		: Get AC min value
*	Argurments		: ch : channel number
*	Return value	: AC min value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned char GetACMinValue(unsigned char ch)
{
	unsigned char fr_ac_min_value;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	fr_ac_min_value = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xFC);

	return fr_ac_min_value;
}

/* *****************************************************************************
*	Description		: Get AC max value
*	Argurments		: ch : channel number
*	Return value	: AC max value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned char GetACMaxValue(unsigned char ch)
{
	unsigned char fr_ac_max_value;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	fr_ac_max_value = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xFD);

	return fr_ac_max_value;
}

/* *****************************************************************************
*	Description		: Get DC max value
*	Argurments		: ch : channel number
*	Return value	: DC max value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned char GetDCValue(unsigned char ch)
{
	unsigned char fr_dc_value;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	fr_dc_value = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xFE);

	return fr_dc_value;
}

/* *****************************************************************************
*	Description		: Set Analog IP
*	Argurments		: ch : channel number
*	Return value	:
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned char SetAnalogIP(unsigned char ch)
{
	/*  set Analog IP  */
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x00);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x00 + (ch % 4), 0x00);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x01, 0x02);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x5B, 0x02);

	printk(">>>>> DRV : EQ Setting and analog resetting\n");

	return 0;
}

/* *****************************************************************************
*	Description		: Set FSC lock mode and speed for Color locking
*	Argurments		: ch : channel number, val(value)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
void SetFSClockmodeForColorlocking(unsigned char ch)
{
	unsigned char temp = 0x00;
	unsigned char acc_gain = 0x00;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);

	temp = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0x25);
	if (temp == 0xCC) {
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x25, 0xDC);
		msleep(33);
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x25, 0xCC);
	} else {
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x25, 0xCC);
		msleep(33);
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x25, 0xDC);
	}

	acc_gain = GetAccGain(ch);
	printk(">>>>> DRV[%s:%d] CH:%d FSC Lock Mode. acc_gain:0x%x(%d)\n",
	       __func__, __LINE__, ch, acc_gain, acc_gain);
}

/* ******************************************************************************
*	Description		:
*	Argurments		:
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
int get_resol_to_eqtable(unsigned char ch, int resol, int vfmt)
{
	int tbl_num = 0;

	switch (resol) {
	case NVP6134_VI_1080P_2530:
	case NVP6134_VI_1080P_NRT:
	case NVP6134_VI_720P_5060:
		tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AFHD_2550
					: EQ_VIDEO_MODE_AFHD_3060;
		printk(">>>>> DRV : %s\n",
		       (vfmt == PAL) ? "EQ_VIDEO_MODE_AFHD_2550"
				     : "EQ_VIDEO_MODE_AFHD_3060");
		break;
	case NVP6134_VI_720P_2530:
	case NVP6134_VI_HDEX:
		if (g_slp_ahd[ch] == 1) {
			tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AHD_GAIN_25
						: EQ_VIDEO_MODE_AHD_GAIN_30;
			printk(">>>>> DRV : %s\n",
			       (vfmt == PAL) ? "EQ_VIDEO_MODE_AHD_GAIN_25"
					     : "EQ_VIDEO_MODE_AHD_GAIN_30");
		} else {
			tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AHD_25
						: EQ_VIDEO_MODE_AHD_30;
			printk(">>>>> DRV : %s\n",
			       (vfmt == PAL) ? "EQ_VIDEO_MODE_AHD_25"
					     : "EQ_VIDEO_MODE_AHD_30");
		}
		break;
	case NVP6134_VI_3M_NRT: /*  separate 3M  */
		tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AHD_3M_18
					: EQ_VIDEO_MODE_AHD_3M_18;
		printk(">>>>> DRV : EQ_VIDEO_MODE_AHD_3M_18\n");
		break;
	case NVP6134_VI_3M:
		tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AHD_3M_25
					: EQ_VIDEO_MODE_AHD_3M_30;
		printk(">>>>> DRV : %s\n",
		       (vfmt == PAL) ? "EQ_VIDEO_MODE_AHD_3M_25"
				     : "EQ_VIDEO_MODE_AHD_3M_30");
		break;
	case NVP6134_VI_4M_NRT:
		tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AHD_4M_NRT
					: EQ_VIDEO_MODE_AHD_4M_NRT;
		printk(">>>>> DRV : NVP6134_VI_4M_NRT\n");
		break;
	case NVP6134_VI_4M:
		tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AHD_4M_25P
					: EQ_VIDEO_MODE_AHD_4M_30P;
		printk(">>>>> DRV : NVP6134_VI_4M\n");
		break;
	case NVP6134_VI_5M_NRT: /*  12p  */
		tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AHD_5M_12_5P
					: EQ_VIDEO_MODE_AHD_5M_12_5P;
		printk(">>>>> DRV : NVP6134_VI_5M_NRT\n");
		break;
	case NVP6134_VI_5M_20P:
		tbl_num = (vfmt == PAL) ? EQ_VIDEO_MODE_AHD_5M_20P
					: EQ_VIDEO_MODE_AHD_5M_20P;
		printk(">>>>> DRV : NVP6134_VI_5M_20P\n");
		break;
	default:
		printk(">>>>> DRV : default!\n");
		break;
	}

	return tbl_num;
}
/* ******************************************************************************
*	Description		: set eq value for CHD, AHD
*	Argurments		: ch : channel, analog_eq_val(AEQ),
*digital_eq1_val(DEQ1),
*					  digital_eq2_val(DEQ2)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
void eq_analog_ip_set_value(unsigned char ch, unsigned char g_sel_val,
			    unsigned char b_lpf_val,
			    unsigned char lpf_bypass_val,
			    unsigned char ref_volt_val,
			    unsigned char clk_dly_val)
{
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x00);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x00 + (ch % 4), g_sel_val);

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x01);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x84 + (ch % 4), clk_dly_val);

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x01, b_lpf_val);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x59, lpf_bypass_val);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x5B, ref_volt_val);
}

/* ******************************************************************************
*	Description		: set EQ base set
*	Argurments		: ch : channel, p_param(EQ base value)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
void eq_set_value(unsigned char ch, void *p_param)
{
	equalizer_baseon *p_eqbase = (equalizer_baseon *)p_param;

	/*  set Analog EQ  */
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x58, p_eqbase->eq_analog_eq);

	/*  set Digital EQ1,2  */
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x09);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x80 + (0x20 * (ch % 4)),
		       p_eqbase->eq_digital_eq1);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x81 + (0x20 * (ch % 4)),
		       p_eqbase->eq_digital_eq2);

	/*  set lpf  */
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x00);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x01 + (ch % 4),
		       p_eqbase->eq_g_sel);

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x01, p_eqbase->eq_b_lpf);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x59, p_eqbase->eq_lpf_bypass);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x5B, p_eqbase->eq_ref_volt);

	printk(">>>>> DRV[%s:%d] CH:%d [BASE SET] analog_eq:0x%x, "
	       "digital_eq1:0x%x, digital_eq2:0x%x, g_sel:0x%x, b_lpf:0x%x, "
	       "lpf_bypass:0x%x, ref_volt:0x%x\n",
	       __func__, __LINE__, ch, p_eqbase->eq_analog_eq,
	       p_eqbase->eq_digital_eq1, p_eqbase->eq_digital_eq2,
	       p_eqbase->eq_g_sel, p_eqbase->eq_b_lpf, p_eqbase->eq_lpf_bypass,
	       p_eqbase->eq_ref_volt);
}

/* ******************************************************************************
*	Description		: set EQ Coeff A
*	Argurments		: ch : channel, p_param(EQ coeff A)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
/*  void eq_coeff_A_setting_val(int ch, unsigned char coeff_A_a0_8, unsigned char  */
/*  coeff_A_a0, unsigned char coeff_A_a1, unsigned char coeff_A_a2, unsigned char  */
/*  coeff_A_B0, unsigned char coeff_A_B1, unsigned char coeff_A_B2)  */
void eq_coeff_A_setting_val(unsigned char ch, void *p_param)
{
	equalizer_coeff_a *p_eqcoeffA = (equalizer_coeff_a *)p_param;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x09);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x84 + (0x20 * (ch % 4)),
		       p_eqcoeffA->coeff_A_a0_8);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x85 + (0x20 * (ch % 4)),
		       p_eqcoeffA->coeff_A_a0);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x86 + (0x20 * (ch % 4)),
		       p_eqcoeffA->coeff_A_a1);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x87 + (0x20 * (ch % 4)),
		       p_eqcoeffA->coeff_A_a2);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x88 + (0x20 * (ch % 4)),
		       p_eqcoeffA->coeff_A_B0);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x89 + (0x20 * (ch % 4)),
		       p_eqcoeffA->coeff_A_B1);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x8A + (0x20 * (ch % 4)),
		       p_eqcoeffA->coeff_A_B2);

	printk(">>>>> DRV[%s:%d] CH:%d [ COEFF_A] coeff_A_a0_8:0x%x, "
	       "coeff_A_a0:0x%x, coeff_A_a1:0x%x, coeff_A_a2:0x%x, "
	       "coeff_A_B0:0x%x, coeff_A_B1:0x%x, coeff_A_B2:0x%x\n",
	       __func__, __LINE__, ch, p_eqcoeffA->coeff_A_a0_8,
	       p_eqcoeffA->coeff_A_a0, p_eqcoeffA->coeff_A_a1,
	       p_eqcoeffA->coeff_A_a2, p_eqcoeffA->coeff_A_B0,
	       p_eqcoeffA->coeff_A_B1, p_eqcoeffA->coeff_A_B2);
}

/* ******************************************************************************
*	Description		: set EQ Coeff B
*	Argurments		: ch : channel, p_param(EQ coeff B)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
/*  void eq_coeff_B_setting_val(int ch, unsigned char coeff_B_a0_8, unsigned char  */
/*  coeff_B_a0, unsigned char coeff_B_a1, unsigned char coeff_B_a2, unsigned char  */
/*  coeff_B_B0, unsigned char coeff_B_B1, unsigned char coeff_B_B2)  */
void eq_coeff_B_setting_val(unsigned char ch, void *p_param)
{
	equalizer_coeff_b *p_eqcoeffB = (equalizer_coeff_b *)p_param;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x09);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x8C + (0x20 * (ch % 4)),
		       p_eqcoeffB->coeff_B_a0_8);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x8D + (0x20 * (ch % 4)),
		       p_eqcoeffB->coeff_B_a0);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], (0x8E) + (0x20 * (ch % 4)),
		       p_eqcoeffB->coeff_B_a1);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x8F + (0x20 * (ch % 4)),
		       p_eqcoeffB->coeff_B_a2);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x90 + (0x20 * (ch % 4)),
		       p_eqcoeffB->coeff_B_B0);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x91 + (0x20 * (ch % 4)),
		       p_eqcoeffB->coeff_B_B1);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x92 + (0x20 * (ch % 4)),
		       p_eqcoeffB->coeff_B_B2);

	printk(">>>>> DRV[%s:%d] CH:%d [ COEFF_B] coeff_B_a0_8:0x%x, "
	       "coeff_B_a0:0x%x, coeff_B_a1:0x%x, coeff_B_a2:0x%x, "
	       "coeff_B_B0:0x%x, coeff_B_B1:0x%x, coeff_B_B2:0x%x\n",
	       __func__, __LINE__, ch, p_eqcoeffB->coeff_B_a0_8,
	       p_eqcoeffB->coeff_B_a0, p_eqcoeffB->coeff_B_a1,
	       p_eqcoeffB->coeff_B_a2, p_eqcoeffB->coeff_B_B0,
	       p_eqcoeffB->coeff_B_B1, p_eqcoeffB->coeff_B_B2);
}

/* ******************************************************************************
*	Description		: set color
*	Argurments		: ch : channel, p_param(EQ coeff B)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
/*  void eq_color_setting_val(int ch, unsigned char color_brightness, unsigned  */
/*  char color_contrast, unsigned char color_h_peaking, unsigned char  */
/*  color_saturation, unsigned char color_hue,  */
/* 		unsigned char color_u_gain, unsigned char color_v_gain, unsigned  */
/*  char color_u_offset, unsigned char color_v_offset, unsigned char  */
/*  color_black_level, unsigned char color_fsc_mode,  */
/* 		unsigned char color_acc_ref, unsigned char color_sat_sub,unsigned  */
/*  char eq_h_dly_offset, unsigned char color_yc_delay, unsigned char  */
/*  color_acc_min_val, unsigned char color_acc_max_val)  */
void eq_color_setting_val(unsigned char ch, void *p_param)
{
	equalizer_color *p_eqcolor = (equalizer_color *)p_param;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x00);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x0C + (ch % 4),
		       p_eqcolor->color_brightness);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x10 + (ch % 4),
		       p_eqcolor->color_contrast);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x18 + (ch % 4),
		       p_eqcolor->color_h_peaking);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x3C + (ch % 4),
		       p_eqcolor->color_saturation);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x40 + (ch % 4),
		       p_eqcolor->color_hue);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x44 + (ch % 4),
		       p_eqcolor->color_u_gain);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x48 + (ch % 4),
		       p_eqcolor->color_v_gain);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x4C + (ch % 4),
		       p_eqcolor->color_u_offset);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x50 + (ch % 4),
		       p_eqcolor->color_v_offset);

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x20,
		       p_eqcolor->color_black_level);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x25,
		       p_eqcolor->color_fsc_mode);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x27,
		       p_eqcolor->color_acc_ref);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x2B,
		       p_eqcolor->color_sat_sub);

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x00);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x58 + (ch % 4),
		       p_eqcolor->eq_h_dly_offset);
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xA0 + (ch % 4),
		       p_eqcolor->color_yc_delay);

	printk(">>>>> DRV[%s:%d] CH:%d [ COLOR ] brightness:0x%x, "
	       "contrast:0x%x, h_peaking:0x%x, saturation:0x%x, hue:0x%x, "
	       "u_gain:0x%x, v_gain:0x%x, u_offset:0x%x\n",
	       __func__, __LINE__, ch, p_eqcolor->color_brightness,
	       p_eqcolor->color_contrast, p_eqcolor->color_h_peaking,
	       p_eqcolor->color_saturation, p_eqcolor->color_hue,
	       p_eqcolor->color_u_gain, p_eqcolor->color_v_gain,
	       p_eqcolor->color_u_offset);

	printk(">>>>> DRV[%s:%d] CH:%d [ COLOR ] v_offset:0x%x, "
	       "black_level:0x%x, fsc_mode:0x%x, acc_ref:0x%x, sat_sub:0x%x, "
	       "h_dly_offset:0x%x, yc_delay:0x%x\n",
	       __func__, __LINE__, ch, p_eqcolor->color_v_offset,
	       p_eqcolor->color_black_level, p_eqcolor->color_fsc_mode,
	       p_eqcolor->color_acc_ref, p_eqcolor->color_sat_sub,
	       p_eqcolor->eq_h_dly_offset, p_eqcolor->color_yc_delay);
}

/* ******************************************************************************
*	Description		: set eq value for CHD, AHD
*	Argurments		: ch : channel, resol : resolution,  vfmt :
*vidoe format(NTSC/PAL)
*					  stage : distance
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
static int get_eq_setting_value(unsigned char ch, int tbl_num, int stage,
				int val)
{
	int ret = 0;

	if (tbl_num == EQ_VIDEO_MODE_AFHD_2550)
		ret = s_eq_1080p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AFHD_3060)
		ret = s_eq_1080p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_25)
		ret = s_eq_720p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_30)
		ret = s_eq_720p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_25)
		ret = s_eq_720p2550_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_30)
		ret = s_eq_720p3060_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_30)
		ret = s_eq_chd_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_25)
		ret = s_eq_chd_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_30)
		ret = s_eq_chd_720p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_25)
		ret = s_eq_chd_720p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_60)
		ret = s_eq_chd_720p60[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_50)
		ret = s_eq_chd_720p50[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_25)
		ret = s_eq_thd_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_30)
		ret = s_eq_thd_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A25)
		ret = s_eq_thd_720p25A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A30)
		ret = s_eq_thd_720p30A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B25)
		ret = s_eq_thd_720p25B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B30)
		ret = s_eq_thd_720p30B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_18)
		ret = s_eq_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_25)
		ret = s_eq_3m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_30)
		ret = s_eq_3m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_3M_18)
		ret = s_eq_thd_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_5M_18)
		ret = s_eq_thd_5m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_NRT)
		ret = s_eq_4m_nrt[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_25P)
		ret = s_eq_4m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_30P)
		ret = s_eq_4m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_12_5P)
		ret = s_eq_5m_12_5p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_20P)
		ret = s_eq_5m_20p[stage][val];

	return ret;
}

/* ******************************************************************************
*	Description		: get a coeff_A
*	Argurments		: ch(channel), tbl_num(table number), stage,
*val(idex)
*	Return value	: value acording to the index
*	Modify			:
*	warning			:
****************************************************************************** */
static int get_coeff_A_setting_value(unsigned char ch, int tbl_num, int stage,
				     int val)
{
	int ret = 0;

	if (tbl_num == EQ_VIDEO_MODE_AFHD_2550)
		ret = s_eq_A_coeff_1080p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AFHD_3060)
		ret = s_eq_A_coeff_1080p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_25)
		ret = s_eq_A_coeff_720p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_30)
		ret = s_eq_A_coeff_720p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_25)
		ret = s_eq_A_coeff_720p2550_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_30)
		ret = s_eq_A_coeff_720p3060_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_30)
		ret = s_eq_chd_A_coeff_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_25)
		ret = s_eq_chd_A_coeff_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_30)
		ret = s_eq_chd_A_coeff_720p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_25)
		ret = s_eq_chd_A_coeff_720p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_60)
		ret = s_eq_chd_A_coeff_720p60[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_50)
		ret = s_eq_chd_A_coeff_720p50[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_25)
		ret = s_eq_thd_A_coeff_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_30)
		ret = s_eq_thd_A_coeff_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A25)
		ret = s_eq_thd_A_coeff_720p25A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A30)
		ret = s_eq_thd_A_coeff_720p30A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B25)
		ret = s_eq_thd_A_coeff_720p25B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B30)
		ret = s_eq_thd_A_coeff_720p30B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_18)
		ret = s_eq_A_coeff_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_25)
		ret = s_eq_A_coeff_3m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_30)
		ret = s_eq_A_coeff_3m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_3M_18)
		ret = s_eq_thd_A_coeff_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_5M_18)
		ret = s_eq_thd_A_coeff_5m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_NRT)
		ret = s_eq_A_coeff_4m_nrt[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_25P)
		ret = s_eq_A_coeff_4m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_30P)
		ret = s_eq_A_coeff_4m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_12_5P)
		ret = s_eq_A_coeff_5m_12_5p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_20P)
		ret = s_eq_A_coeff_5m_20p[stage][val];

	return ret;
}

/* ******************************************************************************
*	Description		: get a coeff_B
*	Argurments		: ch(channel), tbl_num(table number), stage,
*val(idex)
*	Return value	: value acording to the index
*	Modify			:
*	warning			:
****************************************************************************** */
static int get_coeff_B_setting_value(unsigned char ch, int tbl_num, int stage,
				     int val)
{
	int ret = 0;

	if (tbl_num == EQ_VIDEO_MODE_AFHD_2550)
		ret = s_eq_B_coeff_1080p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AFHD_3060)
		ret = s_eq_B_coeff_1080p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_25)
		ret = s_eq_B_coeff_720p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_30)
		ret = s_eq_B_coeff_720p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_25)
		ret = s_eq_B_coeff_720p2550_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_30)
		ret = s_eq_B_coeff_720p3060_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_30)
		ret = s_eq_chd_B_coeff_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_25)
		ret = s_eq_chd_B_coeff_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_30)
		ret = s_eq_chd_B_coeff_720p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_25)
		ret = s_eq_chd_B_coeff_720p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_60)
		ret = s_eq_chd_B_coeff_720p60[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_50)
		ret = s_eq_chd_B_coeff_720p50[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_25)
		ret = s_eq_thd_B_coeff_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_30)
		ret = s_eq_thd_B_coeff_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A25)
		ret = s_eq_thd_B_coeff_720p25A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A30)
		ret = s_eq_thd_B_coeff_720p30A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B25)
		ret = s_eq_thd_B_coeff_720p25B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B30)
		ret = s_eq_thd_B_coeff_720p30B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_18)
		ret = s_eq_B_coeff_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_25)
		ret = s_eq_B_coeff_3m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_30)
		ret = s_eq_B_coeff_3m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_3M_18)
		ret = s_eq_thd_B_coeff_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_5M_18)
		ret = s_eq_thd_B_coeff_5m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_NRT)
		ret = s_eq_B_coeff_4m_nrt[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_25P)
		ret = s_eq_B_coeff_4m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_30P)
		ret = s_eq_B_coeff_4m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_12_5P)
		ret = s_eq_B_coeff_5m_12_5p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_20P)
		ret = s_eq_B_coeff_5m_20p[stage][val];

	return ret;
}

/* ******************************************************************************
*	Description		: get a color value
*	Argurments		: ch(channel), tbl_num(table number), stage,
*val(idex)
*	Return value	: value acording to the index
*	Modify			:
*	warning			:
****************************************************************************** */
static int get_color_setting_value(unsigned char ch, int tbl_num, int stage,
				   int val)
{
	int ret = 0;

	if (tbl_num == EQ_VIDEO_MODE_AFHD_2550)
		ret = s_eq_color_1080p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AFHD_3060)
		ret = s_eq_color_1080p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_25)
		ret = s_eq_color_720p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_30)
		ret = s_eq_color_720p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_25)
		ret = s_eq_color_720p2550_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_30)
		ret = s_eq_color_720p3060_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_30)
		ret = s_eq_chd_color_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_25)
		ret = s_eq_chd_color_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_30)
		ret = s_eq_chd_color_720p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_25)
		ret = s_eq_chd_color_720p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_60)
		ret = s_eq_chd_color_720p60[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_50)
		ret = s_eq_chd_color_720p50[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_25)
		ret = s_eq_thd_color_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_30)
		ret = s_eq_thd_color_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A25)
		ret = s_eq_thd_color_720p25A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A30)
		ret = s_eq_thd_color_720p30A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B25)
		ret = s_eq_thd_color_720p25B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B30)
		ret = s_eq_thd_color_720p30B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_18)
		ret = s_eq_color_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_25)
		ret = s_eq_color_3m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_30)
		ret = s_eq_color_3m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_3M_18)
		ret = s_eq_thd_color_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_5M_18)
		ret = s_eq_thd_color_5m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_NRT)
		ret = s_eq_color_4m_nrt[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_25P)
		ret = s_eq_color_4m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_30P)
		ret = s_eq_color_4m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_12_5P)
		ret = s_eq_color_5m_12_5p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_20P)
		ret = s_eq_color_5m_20p[stage][val];

	return ret;
}

/* ******************************************************************************
*	Description		: Set EQ value
*	Argurments		: ch(channel information)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
void eq_adjust_eqvalue(unsigned char ch, unsigned char resol, int vfmt,
		       int stage)
{
	int tbl_num = 0;
	unsigned char ckill = 0;
	unsigned int agc_gain = 0;
	equalizer_baseon eqbase;
	equalizer_coeff_a eqcoeffA;
	equalizer_coeff_b eqcoeffB;
	equalizer_color eqcolor;

	if ((ch_mode_status[ch] < NVP6134_VI_720P_2530) ||
	    (ch_mode_status[ch] >= NVP6134_VI_BUTT))
		return;

	/*  get a EQ table number according to resolution  */
	tbl_num = get_resol_to_eqtable(ch, resol, vfmt);

	/*  set eq value  */
	eqbase.eq_analog_eq = get_eq_setting_value(ch, tbl_num, stage, 0);
	eqbase.eq_digital_eq1 = get_eq_setting_value(ch, tbl_num, stage, 1);
	eqbase.eq_digital_eq2 = get_eq_setting_value(ch, tbl_num, stage, 2);
	eqbase.eq_g_sel = get_eq_setting_value(ch, tbl_num, stage, 3);
	eqbase.eq_b_lpf = get_eq_setting_value(ch, tbl_num, stage, 4);
	eqbase.eq_lpf_bypass = get_eq_setting_value(ch, tbl_num, stage, 5);
	eqbase.eq_ref_volt = get_eq_setting_value(ch, tbl_num, stage, 6);
	eq_set_value(ch, &eqbase);

	eqcoeffA.coeff_A_a0_8 =
	    get_coeff_A_setting_value(ch, tbl_num, stage, 0);
	eqcoeffA.coeff_A_a0 = get_coeff_A_setting_value(ch, tbl_num, stage, 1);
	eqcoeffA.coeff_A_a1 = get_coeff_A_setting_value(ch, tbl_num, stage, 2);
	eqcoeffA.coeff_A_a2 = get_coeff_A_setting_value(ch, tbl_num, stage, 3);
	eqcoeffA.coeff_A_B0 = get_coeff_A_setting_value(ch, tbl_num, stage, 4);
	eqcoeffA.coeff_A_B1 = get_coeff_A_setting_value(ch, tbl_num, stage, 5);
	eqcoeffA.coeff_A_B2 = get_coeff_A_setting_value(ch, tbl_num, stage, 6);
	eq_coeff_A_setting_val(ch, &eqcoeffA);

	eqcoeffB.coeff_B_a0_8 =
	    get_coeff_B_setting_value(ch, tbl_num, stage, 0);
	eqcoeffB.coeff_B_a0 = get_coeff_B_setting_value(ch, tbl_num, stage, 1);
	eqcoeffB.coeff_B_a1 = get_coeff_B_setting_value(ch, tbl_num, stage, 2);
	eqcoeffB.coeff_B_a2 = get_coeff_B_setting_value(ch, tbl_num, stage, 3);
	eqcoeffB.coeff_B_B0 = get_coeff_B_setting_value(ch, tbl_num, stage, 4);
	eqcoeffB.coeff_B_B1 = get_coeff_B_setting_value(ch, tbl_num, stage, 5);
	eqcoeffB.coeff_B_B2 = get_coeff_B_setting_value(ch, tbl_num, stage, 6);
	eq_coeff_B_setting_val(ch, &eqcoeffB);

	eqcolor.color_brightness =
	    get_color_setting_value(ch, tbl_num, stage, 0);
	eqcolor.color_contrast = get_color_setting_value(ch, tbl_num, stage, 1);
	eqcolor.color_h_peaking =
	    get_color_setting_value(ch, tbl_num, stage, 2);
	eqcolor.color_saturation =
	    get_color_setting_value(ch, tbl_num, stage, 3);
	eqcolor.color_hue = get_color_setting_value(ch, tbl_num, stage, 4);
	eqcolor.color_u_gain = get_color_setting_value(ch, tbl_num, stage, 5);
	eqcolor.color_v_gain = get_color_setting_value(ch, tbl_num, stage, 6);
	eqcolor.color_u_offset = get_color_setting_value(ch, tbl_num, stage, 7);
	eqcolor.color_v_offset = get_color_setting_value(ch, tbl_num, stage, 8);
	eqcolor.color_black_level =
	    get_color_setting_value(ch, tbl_num, stage, 9);
	eqcolor.color_fsc_mode =
	    get_color_setting_value(ch, tbl_num, stage, 10);
	eqcolor.color_acc_ref = get_color_setting_value(ch, tbl_num, stage, 11);
	eqcolor.color_sat_sub = get_color_setting_value(ch, tbl_num, stage, 12);
	eqcolor.eq_h_dly_offset =
	    get_color_setting_value(ch, tbl_num, stage, 13);
	eqcolor.color_yc_delay =
	    get_color_setting_value(ch, tbl_num, stage, 14);
	eqcolor.color_acc_min_val =
	    get_color_setting_value(ch, tbl_num, stage, 15);
	eqcolor.color_acc_max_val =
	    get_color_setting_value(ch, tbl_num, stage, 16);
	eq_color_setting_val(ch, &eqcolor);

/*  Y_slope && cur_acc_gain matching.  */
#if VIN_FALSE
	msleep(50);
	cur_acc_gain_val =  GetAccGain(ch);
	while ((matching_cnt <= 3)) {/*  fsc locking is ok */
		if ((cur_acc_gain_val >= acc_min_val) && (cur_acc_gain_val <= acc_max_val)) {
			printk(">>>>> DRV[%s:%d]  y_slp ^ c_acc_gain is matched!!!\n", __func__, __LINE__);
			break;
		} else {
			gpio_i2c_write(nvp6134_iic_addr[ch/4], 0xFF, 0x05+ch%4);
			gpio_i2c_write(nvp6134_iic_addr[ch/4], 0x23, 0x80); /*  PN init - unlock */
			msleep(35);
			gpio_i2c_write(nvp6134_iic_addr[ch/4], 0x23, 0x00); /*  PN init Toggle */
			msleep(35);
			gpio_i2c_write(nvp6134_iic_addr[ch/4], 0x23, 0x80); /*  PN init Toggle */
			msleep(35);
			gpio_i2c_write(nvp6134_iic_addr[ch/4], 0x23, 0x00); /*  PN init Toggle */
			cur_acc_gain_val =  GetAccGain(ch);
			matching_cnt++;
			printk(">>>>> DRV[%s:%d] %d : y_slp && c_acc_gain is not matched. or not CVI foramt. stage = %d, acc_gain = %d\n", __func__, __LINE__, matching_cnt+1, stage, cur_acc_gain_val);
			printk(">>>>> DRV[%s:%d] %d : min_acc_gain = %d , max_acc_gain = %d\n", __func__, __LINE__, matching_cnt+1, acc_min_val, acc_max_val);
		}
	}

	if ((ch_mode_status[ch] == NVP6134_VI_EXC_720P) ||
		(ch_mode_status[ch] == NVP6134_VI_EXC_HDEX) ||
		(ch_mode_status[ch] == NVP6134_VI_EXC_1080P) ||
		(ch_mode_status[ch] == NVP6134_VI_EXT_720PA) ||
		(ch_mode_status[ch] == NVP6134_VI_EXT_720PB) ||
		(ch_mode_status[ch] == NVP6134_VI_EXT_HDAEX) ||
		(ch_mode_status[ch] == NVP6134_VI_EXT_HDBEX) ||
		(ch_mode_status[ch] == NVP6134_VI_EXT_1080P)) {
		cur_acc_gain_val =  GetAccGain(ch);

		if (cur_acc_gain_val > 2000) {
			gpio_i2c_write(nvp6134_iic_addr[ch/4], 0xFF, 0x05+(ch%4));
			gpio_i2c_write(nvp6134_iic_addr[ch/4], 0x23, 0x80);
			msleep(10);
			gpio_i2c_write(nvp6134_iic_addr[ch/4], 0x23, 0x00);
			printk(">>>>>>>>> drv : Finish Adjust EQ. Pn_Init before.CH[%d] GAIN[%d]<<<<<<<<<<<<\n", ch, cur_acc_gain_val);
			cur_acc_gain_val =  GetAccGain(ch);
			printk(">>>>>>>>> drv : Finish Adjust EQ. Pn_Init After. CH[%d] GAIN[%d]<<<<<<<<<<<<\n", ch, cur_acc_gain_val);
		} else {
			printk(">>>>>>>>> drv : Finish Adjust EQ. No Pn_Init. CH[%d] GAIN[%d]<<<<<<<<<<<<\n", ch, cur_acc_gain_val);
		}
	} else {
		cur_acc_gain_val =  GetAccGain(ch);
		printk(">>>>>>>>> drv : AFE  NOT OFF CH[%d] GAIN[%d]<<<<<<<<<<<<\n", ch, cur_acc_gain_val);
	}
#else
	if (nvp6134_GetFSCLockStatus(ch) == 0)
		SetFSClockmodeForColorlocking(ch);

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x00);
	ckill = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE8 + (ch % 4));
	agc_gain = GetAccGain(ch);
	printk(">>>>> DRV[%s:%d] 2.CH:%d, CKILL:0x%x, AGC_gain:0x%x\n",
	       __func__, __LINE__, ch, ckill, agc_gain);
#endif
}

void eq_adjust_recovery(unsigned char ch, unsigned char resol, int vfmt,
			int stage, char *start_val, char *end_val)
{
	int tbl_num = 0;

	/*  get a EQ table number according to resolution  */
	tbl_num = get_resol_to_eqtable(ch, resol, vfmt);

	/*  get value for use recovery data  */
	*start_val = get_eq_setting_value(ch, tbl_num, stage, 4);
	*end_val = get_eq_setting_value(ch, tbl_num, stage, 5);
}

/* ******************************************************************************
*	Description		: get eq stage for CHD, AHD
*	Argurments		: 1).resol : resolution,
*					  2).In case of AHD, CVID
*							  value1 : y_plus_slp(y plus
*slope)
*							  value2 : y_minus_slp(y minus
*slope)
*							  value3 : reserved
*					  In case of THD
*							  value1 : EQ pattern Color
*Gain value
*							  value2 : reserved
*							  value3 : reserved
*					  vfmt : vidoe format(NTSC/PAL)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned char eq_get_thd_stage(unsigned char ch, unsigned char resol, int vfmt)
{
	unsigned char stage = 0;
	unsigned int decision_value = 0;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x58, 0x93);
	msleep(10);
	decision_value = GetAccGain(ch);

	if (decision_value == s_eq_thd_re_table[0][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_0; /*  No EQ(NO INPUT)  */
	else if (decision_value <= s_eq_thd_re_table[1][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_1; /*  0~50M(short)  */
	else if (decision_value <= s_eq_thd_re_table[2][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_2; /*  50~150M  */
	else if (decision_value <= s_eq_thd_re_table[3][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_3; /*  150~250M  */
	else if (decision_value <= s_eq_thd_re_table[4][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_4; /*  250~350M  */
	else if (decision_value <= s_eq_thd_re_table[5][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_5; /*  350~450M  */
	else
		stage = EQ_STAGE_6;

	return stage;
}

/* ******************************************************************************
*	Description		: get eq stage for CHD, AHD
*	Argurments		: 1).resol : resolution,
*					  2).In case of AHD, CVID
*							  value1 : y_plus_slp(y plus
*slope)
*							  value2 : y_minus_slp(y minus
*slope)
*							  value3 : reserved
*					  In case of THD
*							  value1 : EQ pattern Color
*Gain value
*							  value2 : reserved
*							  value3 : reserved
*					  vfmt : vidoe format(NTSC/PAL)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned char eq_get_thd_stage_720P_A(unsigned char ch, unsigned char resol,
				      int vfmt)
{
	unsigned char stage = 0;
	unsigned int decision_value = 0;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x58, 0x93);
	msleep(10);
	decision_value = GetAccGain(ch);

	if (decision_value == s_eq_thd_re_table_720P_A[0][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_0; /*  No EQ(NO INPUT)  */
	else if (decision_value <=
		 s_eq_thd_re_table_720P_A[1][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_1; /*  0~50M(short)  */
	else if (decision_value <=
		 s_eq_thd_re_table_720P_A[2][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_2; /*  50~150M  */
	else if (decision_value <=
		 s_eq_thd_re_table_720P_A[3][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_3; /*  150~250M  */
	else if (decision_value <=
		 s_eq_thd_re_table_720P_A[4][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_4; /*  250~350M  */
	else if (decision_value <=
		 s_eq_thd_re_table_720P_A[5][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_5; /*  350~450M  */
	else
		stage = EQ_STAGE_6;

	return stage;
}

unsigned char eq_get_cvi_stage_720P50(unsigned char ch, unsigned char resol,
				      int vfmt)
{
	unsigned char stage = 0;
	unsigned int decision_value = 0;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x58, 0x93);
	printk(" THD EQ_SUB_STAGE IN!!!!!!!!!!! EQ = 0x93 APLLYED!!!!!!!!");
	msleep(10);
	decision_value = GetAccGain(ch);

	if (decision_value == s_eq_cvi_re_table_720P50[0][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_0; /*  No EQ(NO INPUT)  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P50[1][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_1; /*  0~50M(short)  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P50[2][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_2; /*  50~150M  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P50[3][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_3; /*  150~250M  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P50[4][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_4; /*  250~350M  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P50[5][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_5; /*  350~450M  */
	else
		stage = EQ_STAGE_6;

	return stage;
}

unsigned char eq_get_cvi_stage_720P60(unsigned char ch, unsigned char resol,
				      int vfmt)
{
	int stage = 0;
	unsigned int decision_value = 0;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x58, 0x93);
	printk(" THD EQ_SUB_STAGE IN!!!!!!!!!!! EQ = 0x93 APLLYED!!!!!!!!");
	msleep(10);
	decision_value = GetAccGain(ch);

	if (decision_value == s_eq_cvi_re_table_720P60[0][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_0; /*  No EQ(NO INPUT)  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P60[1][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_1; /*  0~50M(short)  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P60[2][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_2; /*  50~150M  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P60[3][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_3; /*  150~250M  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P60[4][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_4; /*  250~350M  */
	else if (decision_value <=
		 s_eq_cvi_re_table_720P60[5][EQ_DEFAULT_STAGE_VAL])
		stage = EQ_STAGE_5; /*  350~450M  */
	else
		stage = EQ_STAGE_6;

	return stage;
}
/* ******************************************************************************
*	Description		: get eq stage for CHD, AHD
*	Argurments		: 1).resol : resolution,
*					  2).In case of AHD, CVID
*							  value1 : y_plus_slp(y plus
*slope)
*							  value2 : y_minus_slp(y minus
*slope)
*							  value3 : reserved
*					  In case of THD
*							  value1 : EQ pattern Color
*Gain value
*							  value2 : reserved
*							  value3 : reserved
*					  vfmt : vidoe format(NTSC/PAL)
*	Return value	: void
*	Modify			:
*	warning			:
****************************************************************************** */

static int get_eq_stage_setting_value(int tbl_num, int stage, int val)
{
	int ret = 0;

	if (tbl_num == EQ_VIDEO_MODE_AFHD_2550)
		ret = s_eq_distance_1080p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AFHD_3060)
		ret = s_eq_distance_1080p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_25)
		ret = s_eq_distance_720p2550[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_30)
		ret = s_eq_distance_720p3060[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_25)
		ret = s_eq_distance_720p2550_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_GAIN_30)
		ret = s_eq_distance_720p3060_gain[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_30)
		ret = s_eq_distance_chd_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CFHD_25)
		ret = s_eq_distance_chd_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_30)
		ret = s_eq_distance_chd_720p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_60)
		ret = s_eq_distance_chd_720p60[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_25)
		ret = s_eq_distance_chd_720p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_CHD_50)
		ret = s_eq_distance_chd_720p50[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_25)
		ret = s_eq_distance_thd_1080p25[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_TFHD_30)
		ret = s_eq_distance_thd_1080p30[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A25)
		ret = s_eq_distance_thd_720p25A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_A30)
		ret = s_eq_distance_thd_720p30A[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B25)
		ret = s_eq_distance_thd_720p25B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_B30)
		ret = s_eq_distance_thd_720p30B[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_18)
		ret = s_eq_distance_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_25)
		ret = s_eq_distance_3m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_3M_30)
		ret = s_eq_distance_3m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_3M_18)
		ret = s_eq_distance_thd_3m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_THD_5M_18)
		ret = s_eq_distance_thd_5m_18p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_NRT)
		ret = s_eq_distance_4m_nrt[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_25P)
		ret = s_eq_distance_4m_25p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_4M_30P)
		ret = s_eq_distance_4m_30p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_12_5P)
		ret = s_eq_distance_5m_12_5p[stage][val];
	else if (tbl_num == EQ_VIDEO_MODE_AHD_5M_20P)
		ret = s_eq_distance_5m_20p[stage][val];

	return ret;
}

unsigned char eq_get_stage(unsigned char ch, unsigned char resol,
			   unsigned int value1, unsigned int value2,
			   unsigned int value3, int vfmt)
{
	int eq_tbl_num;
	int y_plus_slp = 0;
	int y_minus_slp = 0;
	int h_sync_width = 0;
	int acc_gain = 0;
	int acc_gain93 = 0;
	int stage = 0;
	int decision_value = 0;
	int cabletype = CABLE_TYPE_COAX; /*  g_devconfig.cabletype.type[ch];  */

	printk(">>>>> DRV[%s:%d] CH:%d, Cable type : %s\n", __func__, __LINE__,
	       ch, (cabletype == CABLE_TYPE_COAX) ? "Coaxial" : "UTP");

	/*  get a EQ table number according to resolution
	 * You can see s_eq_distance_table table structure  */
	eq_tbl_num = get_resol_to_eqtable(ch, resol, vfmt);

	/*  3M over  */
	if ((resol == NVP6134_VI_3M) || (resol == NVP6134_VI_3M_NRT) ||
	    (resol == NVP6134_VI_4M_NRT) || (resol == NVP6134_VI_4M) ||
	    (resol == NVP6134_VI_5M_NRT) || (resol == NVP6134_VI_5M_20P)) {

		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x27, 0x57);
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x58, 0x03);

		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x09);
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x80 + (ch % 4) * 0x20,
			       0x00);
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x81 + (ch % 4) * 0x20,
			       0x00);
		msleep(35);

		y_plus_slp = GetYPlusSlope(ch);
		y_minus_slp = GetYMinusSlope(ch);

		/*  sum are y minus slope + y plus slope  */
		decision_value = y_minus_slp + y_plus_slp;

		/*  we distinguish 6 stage by using s_eq_distance_table table  */
		if (decision_value ==
		    get_eq_stage_setting_value(eq_tbl_num, 0, cabletype))
			stage = EQ_STAGE_0; /*  No EQ(NO INPUT)  */
		else if (decision_value >=
			 get_eq_stage_setting_value(eq_tbl_num, 1, cabletype))
			stage = EQ_STAGE_1; /*  0~50M(short)  */
		else if (decision_value >=
			 get_eq_stage_setting_value(eq_tbl_num, 2, cabletype))
			stage = EQ_STAGE_2; /*  50~150M  */
		else if (decision_value >=
			 get_eq_stage_setting_value(eq_tbl_num, 3, cabletype))
			stage = EQ_STAGE_3; /*  150~250M  */
		else if (decision_value >=
			 get_eq_stage_setting_value(eq_tbl_num, 4, cabletype))
			stage = EQ_STAGE_4; /*  250~350M  */
		else if (decision_value >=
			 get_eq_stage_setting_value(eq_tbl_num, 5, cabletype))
			stage = EQ_STAGE_5; /*  350~450M  */
		else
			stage = EQ_STAGE_6; /*  450~550M  */

		printk(">>>>> DRV[%s:%d] CH:%d, AHD 3/4/5M. Y_p_slp[%d], "
		       "Y_m_slp[%d], acc_gain[%d], acc_gain(93)[%d], "
		       "h_sync_width[%d]\n",
		       __func__, __LINE__, ch, y_plus_slp, y_minus_slp,
		       acc_gain, acc_gain93, h_sync_width);
		printk(">>>>> DRV[%s:%d] CH:%d, AHD 3/4/5M. Y_p_slp[%d], "
		       "Y_m_slp[%d], acc_gain[%d], acc_gain(93)[%d], "
		       "h_sync_width[%d]\n",
		       __func__, __LINE__, ch, y_plus_slp, y_minus_slp,
		       acc_gain, acc_gain93, h_sync_width);
		printk(">>>>> DRV[%s:%d] CH:%d, AHD 3/4/5M. Y_p_slp[%d], "
		       "Y_m_slp[%d], acc_gain[%d], acc_gain(93)[%d], "
		       "h_sync_width[%d]\n",
		       __func__, __LINE__, ch, y_plus_slp, y_minus_slp,
		       acc_gain, acc_gain93, h_sync_width);
		printk(">>>>> DRV[%s:%d] CH:%d, AHD 3/4/5M. Y_p_slp[%d], "
		       "Y_m_slp[%d], acc_gain[%d], acc_gain(93)[%d], "
		       "h_sync_width[%d]\n",
		       __func__, __LINE__, ch, y_plus_slp, y_minus_slp,
		       acc_gain, acc_gain93, h_sync_width);
		printk(">>>>> DRV[%s:%d] CH:%d, AHD 3/4/5M. Y_p_slp[%d], "
		       "Y_m_slp[%d], acc_gain[%d], acc_gain(93)[%d], "
		       "h_sync_width[%d]\n",
		       __func__, __LINE__, ch, y_plus_slp, y_minus_slp,
		       acc_gain, acc_gain93, h_sync_width);
	}
	/*  AHD 1.0, 2.0  */
	else {
		if (g_slp_ahd[ch] == 1) {
			/*  allocate value(EQ pattern Color Gain value) to
			 * variable for AHD, CHD  */
			decision_value = value1;

			/*  we distinguish 6 stage by using s_eq_distance_table
			 * table  */
			if (decision_value == get_eq_stage_setting_value(
						  eq_tbl_num, 0, cabletype))
				stage = EQ_STAGE_0; /*  No EQ(NO INPUT)  */
			else if (decision_value <=
				 get_eq_stage_setting_value(eq_tbl_num, 1,
							    cabletype))
				stage = EQ_STAGE_1; /*  0~50M(short)  */
			else if (decision_value <=
				 get_eq_stage_setting_value(eq_tbl_num, 2,
							    cabletype))
				stage = EQ_STAGE_2; /*  50~150M  */
			else if (decision_value <=
				 get_eq_stage_setting_value(eq_tbl_num, 3,
							    cabletype))
				stage = EQ_STAGE_3; /*  150~250M  */
			else if (decision_value <=
				 get_eq_stage_setting_value(eq_tbl_num, 4,
							    cabletype))
				stage = EQ_STAGE_4; /*  250~350M  */
			else if (decision_value <=
				 get_eq_stage_setting_value(eq_tbl_num, 5,
							    cabletype))
				stage = EQ_STAGE_5; /*  350~450M  */
			else
				stage = EQ_STAGE_6; /*  450~550M  */
		} else {
			/*  allocate value(y plus, y minus) to variable for AHD,
			 * CHD  */
			y_plus_slp = value1;
			y_minus_slp = value2;

			/*  sum are y minus slope + y plus slope  */
			decision_value = y_minus_slp + y_plus_slp;

			/*  we distinguish 6 stage by using s_eq_distance_table
			 * table  */
			if (decision_value == get_eq_stage_setting_value(
						  eq_tbl_num, 0, cabletype))
				stage = EQ_STAGE_0; /*  No EQ(NO INPUT)  */
			else if (decision_value >=
				 get_eq_stage_setting_value(eq_tbl_num, 1,
							    cabletype))
				stage = EQ_STAGE_1; /*  0~50M(short)  */
			else if (decision_value >=
				 get_eq_stage_setting_value(eq_tbl_num, 2,
							    cabletype))
				stage = EQ_STAGE_2; /*  50~150M  */
			else if (decision_value >=
				 get_eq_stage_setting_value(eq_tbl_num, 3,
							    cabletype))
				stage = EQ_STAGE_3; /*  150~250M  */
			else if (decision_value >=
				 get_eq_stage_setting_value(eq_tbl_num, 4,
							    cabletype))
				stage = EQ_STAGE_4; /*  250~350M  */
			else if (decision_value >=
				 get_eq_stage_setting_value(eq_tbl_num, 5,
							    cabletype))
				stage = EQ_STAGE_5; /*  350~450M  */
			else
				stage = EQ_STAGE_6; /*  450~550M  */
		}
	}

	/*  return value is stage  */
	return stage;
}

/* *****************************************************************************
*	Description		: Get EQ pattern color gain
*	Argurments		: ch : channel number
*	Return value	: EQ pattern color gain value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned int distinguish_GetAccGain(unsigned char ch)
{
	unsigned int acc_gain_status;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	acc_gain_status = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE2);
	acc_gain_status <<= 8;
	acc_gain_status |= gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE3);
	/*  printk("acc_gain_status    : 0x%x\n", acc_gain_status);  */
	return acc_gain_status;
}

/* *****************************************************************************
*	Description		: Get Y plus slope
*	Argurments		: ch : channel number
*	Return value	: Y plus slope value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned int distinguish_GetYPlusSlope(unsigned char ch)
{
	unsigned int y_plus_slp_status;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	y_plus_slp_status = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE8);
	y_plus_slp_status <<= 8;
	y_plus_slp_status |= gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xE9);
	/*  printk("y_plus_slp_status  : 0x%x\n", y_plus_slp_status);  */
	return y_plus_slp_status;
}

/* *****************************************************************************
*	Description		: Get Y minus slope
*	Argurments		: ch : channel number
*	Return value	: Y minus slope value
*	Modify			:
*	warning			:
****************************************************************************** */
unsigned int distinguish_GetYMinusSlope(unsigned char ch)
{
	unsigned int y_minus_slp_status;

	gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + ch % 4);
	y_minus_slp_status = gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xEA);
	y_minus_slp_status <<= 8;
	y_minus_slp_status |= gpio_i2c_read(nvp6134_iic_addr[ch / 4], 0xEB);
	/*  printk("y_minus_slp_status : 0x%x\n", y_minus_slp_status);  */
	return y_minus_slp_status;
}

/* ******************************************************************************
*	Description		: set distinguish type
*	Argurments		: ch(channel)
*	Return value	: void
*	Modify			:
*	warning			: after distingish between AHD and CVI and
*set value(format)
*					  to register 0x05~08
****************************************************************************** */
unsigned char eq_set_distinguish_type(unsigned char ch,
				      unsigned char curvidmode,
				      unsigned char vfmt)
{
	unsigned int sum = 0;
	unsigned char format = 0x00;
	unsigned int decision = 0;
	unsigned int acc_gain_status[16], y_plus_slope[16], y_minus_slope[16];
	unsigned int fmt_det = 0;
	int accgain_timer = 0;

	/*  get acc gain and slope  */
	while (accgain_timer < 1000) {
		if (curvidmode == NVP6134_VI_HDEX ||
		    curvidmode == NVP6134_VI_720P_2530) {
			gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x09);
			gpio_i2c_write(nvp6134_iic_addr[ch / 4],
				       0x80 + ((ch % 4) * 0x20), 0xa4);
			gpio_i2c_write(nvp6134_iic_addr[ch / 4],
				       0x81 + ((ch % 4) * 0x20), 0x00);
			gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF,
				       0x05 + (ch % 4));
			gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x27, 0x20);
			printk(">>>>>>>>>>>>DRV : 720P Gain control for "
			       "detection <<<<<<<<\n");
		} else /*  1080p  */ {
			acc_gain_status[ch] = distinguish_GetAccGain(ch);
			gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF,
				       0x05 + (ch % 4));
			gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x58, 0xD3);
			printk(">>>>>>>>>>>>DRV : 1080P Gain control for "
			       "detection <<<<<<<<\n");
		}
		msleep(35);
		y_plus_slope[ch] = GetYPlusSlope(ch);
		y_minus_slope[ch] = GetYMinusSlope(ch);
		sum = y_plus_slope[ch] + y_minus_slope[ch];
		acc_gain_status[ch] = distinguish_GetAccGain(ch);
		printk(">>>>> DRV[CH%d] acc_gain:%d, y_plus_slope:%d, "
		       "y_minus_slope:%d, sum[yp+ym]:%d\n",
		       ch, acc_gain_status[ch], y_plus_slope[ch],
		       y_minus_slope[ch], sum);

		if ((acc_gain_status[ch] != 0)) {
			if (curvidmode == NVP6134_VI_HDEX ||
			    curvidmode == NVP6134_VI_720P_2530) {
				printk(
				    ">>>>>>>>>>>>DRV : 720P inside <<<<<<<<\n");
				if (((y_plus_slope[ch] < 60) &&
				     (y_minus_slope[ch] < 60))) {
					if (acc_gain_status[ch] > 2020) {
						decision =
						    0; /*  no LE AHD(Old version)  */
						printk(">>>>> DRV[CH%d] "
						       "Distingush AHD or CVI "
						       "=>>> AHD 720P "
						       "G[%d]!!!\n",
						       ch, acc_gain_status[ch]);
						fmt_det = 1;
						g_slp_ahd[ch] =
						    1; /*  check gain value here  */
						       /*  for using gain table  */
					} else {
						decision = 1; /*  cvi  */
						printk(">>>>> DRV[CH%d] "
						       "Distingush AHD or CVI "
						       "=>>> CVI 720P "
						       "G[%d]!!!\n",
						       ch, acc_gain_status[ch]);
						fmt_det = 1;
					}
				} else {
					if (acc_gain_status[ch] > 2020) {
						decision =
						    0; /*  LE AHD(Old version)  */
						printk(">>>>> DRV[CH%d] "
						       "Distingush AHD or CVI "
						       "=>>> AHD 720P "
						       "SLP[%d]!!!\n",
						       ch, acc_gain_status[ch]);
						fmt_det = 1;
						g_slp_ahd[ch] =
						    0; /*  check slope value here  */
						       /*  for using slope table  */
					} else {
						decision = 1; /*  cvi  */
						printk(">>>>> DRV[CH%d] "
						       "Distingush AHD or CVI "
						       "=>>> CVI 720P "
						       "SLP[%d]!!!\n",
						       ch, acc_gain_status[ch]);
						fmt_det = 1;
					}
				}
				/*  msleep(33);  */
				accgain_timer++;
			} else {
				printk(">>>>>>>>>>>>DRV : 1080P inside "
				       "<<<<<<<<\n");
				if (((y_plus_slope[ch] < 30) ||
				     (y_minus_slope[ch] < 30))) {
					decision = 1; /*  cvi  */
					printk(">>>>> DRV[CH%d] Distingush AHD "
					       "or CVI =>>> CVI 1080P "
					       "slp[%d]!!!\n",
					       ch, acc_gain_status[ch]);
					fmt_det = 1;
				} else {
					if (acc_gain_status[ch] > 2010) {
						printk(">>>>>>>>> [%s:%d] "
						       "error!!\n",
						       __func__, __LINE__);
						decision =
						    0; /*  no LE AHD(Old version)  */
						printk(">>>>> DRV[CH%d] "
						       "Distingush AHD or CVI "
						       "=>>> AHD 1080P "
						       "SLP[%d]!!!\n",
						       ch, acc_gain_status[ch]);
						fmt_det = 1;
					} else {
						decision = 1; /*  cvi  */
						printk(">>>>> DRV[CH%d] "
						       "Distingush AHD or CVI "
						       "=>>> CVI 1080P "
						       "SLP[%d]!!!\n",
						       ch, acc_gain_status[ch]);
						fmt_det = 1;
					}
				}
				/*  msleep(33);  */
				accgain_timer++;
			}
		} else {
			accgain_timer++;
			printk(">>> drv : not inside getiing format\n");
		}

		if (fmt_det == 1)
			break;
	}

	if (decision == 0) /*  0:AHD, 1:CVI  */ {
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x5C, format);
		return 1;
	} else {
		/*  CVI - nothing, beacuse The app have already set CVI   */
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0xFF, 0x05 + (ch % 4));
		gpio_i2c_write(nvp6134_iic_addr[ch / 4], 0x5C, 0x00);
	}

	return 0;
}

/* ******************************************************************************
*	End of file
****************************************************************************** */
